Skip to content

Instantly share code, notes, and snippets.

@juliuscanute
Created December 14, 2019 22:10
Show Gist options
  • Select an option

  • Save juliuscanute/9f007a0c459f703c0ea962dae0ce8f5b to your computer and use it in GitHub Desktop.

Select an option

Save juliuscanute/9f007a0c459f703c0ea962dae0ce8f5b to your computer and use it in GitHub Desktop.
Perform the action to load emotions
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