Skip to content

Instantly share code, notes, and snippets.

@apptects
Created April 8, 2019 10:18
Show Gist options
  • Select an option

  • Save apptects/9645bea89d89c203be3921e4962becb6 to your computer and use it in GitHub Desktop.

Select an option

Save apptects/9645bea89d89c203be3921e4962becb6 to your computer and use it in GitHub Desktop.
Dispatch action from asynchronous function
ThunkAction<AppState> getSearchResult = (Store<AppState> store) async {
var response = await http.get(Uri.encodeFull('https://itunes.apple.com/search?term=' + store.state.searchText));
store.dispatch(UpdateTrackItemsAction(_decodeTrackItems(_decodeResultItems(response.body))));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment