shiftAdd<T> function

List<Tuple2<T?, Store<SwipeFeedCardState>>> shiftAdd<T>(
  1. List<Tuple2<T?, Store<SwipeFeedCardState>>> oldItems,
  2. List<Tuple2<T, Store<SwipeFeedCardState>>> newItems
)

Implementation

List<Tuple2<T?, Store<SwipeFeedCardState>>> shiftAdd<T>(List<Tuple2<T?, Store<SwipeFeedCardState>>> oldItems, List<Tuple2<T, Store<SwipeFeedCardState>>> newItems){
  int index = oldItems.indexWhere((element) => element.item1 == null);
  if(index == -1){
    return [Tuple2(null, SwipeFeedCardState.tower())];
  }
  else{
    oldItems.insertAll(index, newItems);
  }
  return oldItems;
}