Skip to content

Instantly share code, notes, and snippets.

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

  • Save juliuscanute/24cda11768a2dee35664bc3fbc8b024b to your computer and use it in GitHub Desktop.

Select an option

Save juliuscanute/24cda11768a2dee35664bc3fbc8b024b to your computer and use it in GitHub Desktop.
Display retrieved emotions view model
class _ViewModelSavedEmotion {
final Store<EmotionAppState> store;
const _ViewModelSavedEmotion({this.store});
static _ViewModelSavedEmotion fromStore(Store<EmotionAppState> store) {
return _ViewModelSavedEmotion(store: store);
}
String getEmotionImage(int index) {
return store.state.details[index].emoji;
}
String getEmotion(int index) {
return store.state.details[index].emotion;
}
String getEmotionDescription(int index) {
return store.state.details[index].emotionDescription;
}
String getDate(int index) {
return store.state.details[index].emotionDate;
}
String getTime(int index) {
return store.state.details[index].emotionTime;
}
int getEmotionCount() {
List<SavedDetail> details = store.state.details ?? [];
return details.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment