-
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
Access store outside flutter widget tree? #13
Comments
Yep! That's totally possible. You're most likely running into a confusing issue with Dart: If you declare a global variable in your Instead, you can move that Let me know if that works for ya! |
sigh thanks mate, and here I was thinking |
Damn I love this package, putting the store in different file worked!!!! |
I'm having issues accessing the store from outside the flutter widget tree, and I'm not quite sure if the problem lies with me or if it's simply not possible.
Say I define a store in my
main.dart
:Then modify the state in the
StoreProvider
's descendants and try to access it:In the example above
attrA
has the most recent state, butattrB
seems to have the store's initial state. Am I making a mistake somewhere or is this a limitation offlutter_redux
?The reason I'd like to get the store singleton outside the widget tree is to add extra store-based functionality to my models, e.g. searching the store for related models etc...
The text was updated successfully, but these errors were encountered: