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
How to return something when an Action is done? #13
Comments
I'm not sure I understand your question. But if you want an action to notify when it finished doing some stuff, you could create a Future and pass its completer to the action, as a parameter to its constructor. Then you return that Future. The action would complete the future as soon as it has finished doing its thing. Does that make sense? |
Thank you for the help (I first tried to solve this with Events). On another note, I'm not quite sure if this not something I should do or not. If not, then a Function something like this in the StoreProvider would be great, to easily dispatch Actions: static void dispatch<St>(BuildContext context, ReduxAction action, Object debug) {
StoreProvider.of<St>(context, debug).dispatch(action);
} |
In any case I don't claim to be an authority in all kinds of possible architecture designs with Redux or even with AsyncRedux. So, I may be wrong. |
This is now live: version: 1.3.8. |
Are @SunlightBro and @SunlightDave the same person? I did some changes in main_dispatch_future.dart, (including changing the file name), but you are the author. If you want you can list yourself as the author in the top file comment. |
Yes same person, |
The RefreshIndicator's onRefresh wants a Future Function(), that returned Future must complete when the refresh operation is finished.
Before I would make the call to the API first and then when the response returns I would dispatch an (synchronous) Action and return null.
Now with ReduxAction that can reduce async, I move the API call inside the Action, but what would be the proper way to return something as soon as the Action is finished ?
The text was updated successfully, but these errors were encountered: