removeItemById<T> function

ThunkAction<SwipeFeedState<T>> removeItemById<T>(
  1. String id,
  2. String objectKey(
    1. T
    )
)

Implementation

ThunkAction<SwipeFeedState<T>> removeItemById<T>(String id, String Function(T) objectKey){
  return (Store<SwipeFeedState<T>> store) async {
    List<Tuple2<T?, Store<SwipeFeedCardState>>> items = store.state.items;
    if(items.isNotEmpty && id == objectKey(items[0].item1!)){
      items.remove(0);
      if(items.isNotEmpty){
        items[0].item2.dispatch(SetSwipeFeedCardState(SwipeCardShowState()));
      }
      store.dispatch(SetItemsEvent(items));
    }
  };
}