Skip to content

Instantly share code, notes, and snippets.

@apptects
Created April 8, 2019 09:35
Show Gist options
  • Select an option

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

Select an option

Save apptects/fb020232f3b081cb80c9402c8c1e3308 to your computer and use it in GitHub Desktop.
Use StoreConnector to create view-model
class _SearchResultListState extends State<SearchResultList> {
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, List<TrackItem>>(
converter: (store) => store.state.trackItems,
builder: (_, trackItems) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
leading: ApptectsButton()
),
body: _SearchResultList(trackItems),
floatingActionButton: _SearchButton()
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment