-
Notifications
You must be signed in to change notification settings - Fork 215
Can't Find Store Producer and Reducer #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey hey... Sorry about the trouble & delay, traveling at the moment. Dang, this is definitely the number 1 problem folks have experienced, and it almost always comes down to a problem with how Dart resolves imports. Could you please try importing all of your files in a consistent way? E.g. always with Relative or always with package-style imports ( If you try those solutions and they don't work, would you be able to provide a bit more code, such as a repo that I could take a look at? |
@brianegan Actually, I now know what the problem is exactly. Normally when working with flutter (or dart in general), I import all packages using the package import method; I never use relative path because i find it is messy. However, sometimes I am rushing and I don't realize that I accidently did import something via relative path. I found this out the hard way in a different situation dart-lang/sdk#33149. It seems you were right about the import paths etc. I will be closing this issue. Thanks for taking the time to get in touch with me. |
Glad it's resolved! I kinda think we should provide more feedback to the Dart team about this issue. I see it come up quite often. |
I read issue #46 and that does seem related to my issue however how there is a bit more in my case.
I took a stateless widget and wrapped the Store Provider in it and attached the Reducer to this widget as a static function. When I tried to wrap the root widget in this stateless widget it gave me the "can't find store provider" error like in #46. If I transplant the Store Provider from the stateless widget and directly put it into my root widget, I am unable to gain access to my reducer (I took the reducer out of the wrapper stateless widget and just made it a normal top level function). I happened to leave the wrapper widget code mostly alone (aside from removing the reducer from it) but its not attached to anything and it finds the reducer when it is passed into the Store Provider there.
On the other hand when I pass the same reducer into the Store Provider in the root widget it gives me this very bizarre error:
the argument type '(AppState, dynamic) → AppState can't be assigned to the parameter type '(AppState, dynamic) → AppState
Any Ideas of what exactly is going on here? This is a really confusing error and even taking the reducer and its logic and putting it directly into my main file does not solve this problem.
The text was updated successfully, but these errors were encountered: