Created
December 14, 2019 22:10
-
-
Save juliuscanute/9f007a0c459f703c0ea962dae0ce8f5b to your computer and use it in GitHub Desktop.
Perform the action to load emotions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<Middleware<EmotionAppState>> createLoginMiddleware( | |
| [DataProvider provider]) { | |
| final loadEmotions = _loadEmotions(provider); | |
| return [ | |
| TypedMiddleware<EmotionAppState, LoadEmotions>(loadEmotions) | |
| ]; | |
| } | |
| Middleware<EmotionAppState> _loadEmotions(DataProvider provider) { | |
| return (Store<EmotionAppState> store, action, NextDispatcher next) async { | |
| List<SavedDetail> emotions = await provider.getEmotions(); | |
| next(LoadedEmotions(details: emotions)); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment