Giter Site home page Giter Site logo

Comments (7)

brianegan avatar brianegan commented on July 19, 2024

Hey there @lockerfish, sorry about that! Could you please tell me which version of Flutter / Redux / flutter_redux you're using?

I can't see anything obviously wrong with the code in the code you've pasted in. Does the example from this repository work for ya?

from flutter_redux.

lockerfish avatar lockerfish commented on July 19, 2024

@brianegan Not problem. I see the benefits of using flutter redux so THANKS!.. I basically took the example from the repo and decompose it, move widgets out to separate files, global stuff, app stuff, etc.. Here is a link to the test project... https://github.com/lockerfish/flutter_redux_test. Check out app.dart file. It breaks when trying to use a new IncrementButton widget... Hope this helps

from flutter_redux.

brianegan avatar brianegan commented on July 19, 2024

Thanks for the full project, I'll take a look :)

from flutter_redux.

brianegan avatar brianegan commented on July 19, 2024

Ah, ok -- you're running into one of the most annyoing things about Dart! For some reason, you need to be very careful when importing files in your own project.

Rather than directly referencing the file, global.dart, you want to specify the full "path":

import 'package:flutter_redux_test/global.dart';

Otherwise, for some reason, Dart will think that import 'global.dart' and import 'package:flutter_redux_test/global.dart'; are different :/

Diff to get it working:

diff --git a/lib/app.dart b/lib/app.dart
index 8205a18..efedfb9 100644
--- a/lib/app.dart
+++ b/lib/app.dart
@@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter_redux_test/increment_button.dart';
 import 'package:redux/redux.dart';
-import 'cool_widget.dart';
-import 'global.dart';
+import 'package:flutter_redux_test/cool_widget.dart';
 
 class FlutterReduxApp extends StatelessWidget {
   final Store<int> store;
diff --git a/lib/main.dart b/lib/main.dart
index b89686f..ab338dd 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:redux/redux.dart';
-import 'global.dart';
-import 'app.dart';
+import 'package:flutter_redux_test/global.dart';
+import 'package:flutter_redux_test/app.dart';
 
 void main() {
   final store = new Store<int>(counterReducer, initialState: 0);

from flutter_redux.

lockerfish avatar lockerfish commented on July 19, 2024

That's it! The good news is VS Code is defaulting to using package.

from flutter_redux.

passsy avatar passsy commented on July 19, 2024

Just ran into this and wasted a full evening...

from flutter_redux.

brianegan avatar brianegan commented on July 19, 2024

@passsy Did ya get it fixed following these instructions? If so, might be good to chime in on the linked issue for the Dart lang Repo. More reports will hopefully bump up the priority.

from flutter_redux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.