-
Notifications
You must be signed in to change notification settings - Fork 215
Accessing store in StoreConnector.builder #34
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
The example at http://blog.novoda.com/introduction-to-redux-in-flutter/ indicates that the methods should be added to the model then the model called which then has access to the store - is this the correct design? |
Yep! You can also see this technique in the example on the README of this package as well. Another option: If your action is static, you can also forego the
The |
Hi, I just tried this out actually but I'm getting a syntax error on the
|
Ack, sorry about that, shouldn't code in Github :P It's |
Thanks Brian for the quick response, unfortunately I'm getting a new error now
I'm using dart 1 with the following versions
if I run it using dart 2 (
I get the runtime message when it hits any redux code:
(I was going to update to flutter master, currently on 0.2.3 but it wasn't immediately obvious how to...let me know if its worth a try) |
Updating to master version worked for me. Many thanks btw, if anyone wants to know how to set dart 2 in vs code (required for debug) the setting to do this (ctrl + ,)
|
@twistedinferno Hah, ya beat me to it :) Yah, there seems to be a Dart 2 bug on Beta channel that only affects some users. Sorry bout that! |
p.s. This needs to be a thing: https://github.com/twistedinferno/yoda-motivator 😸 |
Ha! I forgot that is still up there! I actually wrote it and still use it some days when I need a little zen but...the code is SO bad (I was learning js at the time) that I would like to update just a little before anyone else sees it...I'll update and upload the code sometime next few months and I will let you know :-) |
btw, I am calling dispatch in the build function of my widget to load some data (I don't want it loaded when redux initialises as it is not always necessary and may take time), would you say this is a good location for it?
|
@twistedinferno I would say it's probably not the best place, because the
|
Thanks again Brian, I'll try that out :-) |
@Paul-Todd Hey there -- did I answer your question? Need more help? Happy to keep this open if so, or close out if you're feeling good. |
Thanks, you that did it - moved all my methods to the model and it hangs together nicely! I will try the StoreProvider.of() stuff when I get the chance as this looks like a nice way to do it as well. |
Hi,
I need to have access to the store in the builder function so I can dispatch calls to the middleware. Is there a way to do this "nicely" without storing the store during the call to onInit?
I am new to dart and I just cannot see how to do this.
The use case I am looking at is having a widget display some stateful data and a button. The button when pressed should invoke the store.dispatch(new SomeAction());
Paul
The text was updated successfully, but these errors were encountered: