updateItem<T> function
updates an item in the feed
Implementation
ThunkAction<SwipeFeedState<T>> updateItem<T>(T item, String id, String Function(T) objectKey){
return (Store<SwipeFeedState<T>> store) async {
List<Tuple2<T?, Store<SwipeFeedCardState>>> items = store.state.items;
if(items.isNotEmpty && items[0].item1 != null && id == objectKey(items[0].item1!)){
items.remove(items[0]);
store.dispatch(SetItemsEvent(items));
List<Tuple2<T?, Store<SwipeFeedCardState>>> addNewItem = [Tuple2(item, SwipeFeedCardState.tower(SwipeCardShowState())), ...store.state.items];
store.dispatch(SetItemsEvent(addNewItem));
}
};
}