fluttercommunity / redux.dart

Redux for Dart
https://pub.dev/packages/redux
MIT License
516 stars 61 forks source link

ReduxInit action #57

Closed aler closed 4 years ago

aler commented 4 years ago

Store doesn't dispatch init action once initialized. Both swift and kotlin redux libs do it.

This action is important to setup app long running services on app startup.

brianegan commented 4 years ago

Hey there -- could definitely add something like this in -- in general Redux.js had kept these implementations hidden, and asked users to dispatch their own actions. Would that work for you? I worry about dispatching a new action that folks aren't accounting for.

aler commented 4 years ago

I ended up dispatching custom init action manually right after the store has been created in the flutter main func. It might be harder to do it if you init the store through DI or when the store init timing is not well defined.

I found that js lib keeps init as internal and using it is an anti pattern. So I guess it is no go.