-
Notifications
You must be signed in to change notification settings - Fork 219
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
Fix StoreProvider.of for Reified types #15
Comments
Hrm, interesting case. I think the problem might be: you're constantly rebuilding a new Store in the So whenever you do a Hot Reload or that I'll take a deeper look. For now, could you please try moving the Store out of the |
I'm not sure what you mean, but I moved the app to a stateful widget, created the entire tree (starting from I'll add that initially I created |
Yah that would be great... I haven't run into that issue before :( |
Here it is. Only two new dependencies in pubspec:
Flutter doctor:
|
Yep, you found a bug! This is an interesting problem with how Dart reifies types, and my current solution doesn't quite work unfortunately ;( For now, please use Thanks for the report, good catch! |
StoreBuilder
or StoreConnector
results in a NoSuchMethodError
As a heads up: Got a workaround going to properly support generics. I'll try to push it up soon-ish! |
I encountered the same issue with the example project and just found out it happens if i have the dart 2 preview enabled.. I'm not sure if it's the same issue but disabling the preview fixes it Cheers |
Thanks for the report! I'm actually working on a few changes that fix both this bug and adds Dart2 support :) |
Awesome !! keep up the good work! |
Same issue here, glad I'm not the only one 😅 Meanwhile I replaced the dependency in the
and everything works again, thanks for your work @brianegan 💯 |
Sure thing! Sorry for the delay in publishing the new version, test coverage isn't quite working with Dart 2 and I'd like to hold off until that's fixed. That branch should totally work, however -- so feel free to play around and report issues! |
Will do! |
I'm repeatedly getting
error when trying to use
StoreBuilder
orStoreConnector
in the hierarchy. My app widget builds the rest like this:I can't get it to work, I understand
StoreProvider
is a simple InheritedWidget, but even if I try to manually callnew StoreProvider.of(context)
in a widget down the tree, I getnull
. I don't understand, since I've created dead simple inherited widget and placed it instead ofStoreProvider
and I could fetch it withof()
method without issues (I almost did a copy-paste from the StoreProvider class).The
int
state and inline reducer is just a result of me trying to simplify the things as much as I can, with no luck. Any idea why would it be like this?The text was updated successfully, but these errors were encountered: