swipeFeedStateReducer<T> function

SwipeFeedState<T> swipeFeedStateReducer<T>(
  1. SwipeFeedState<T> state,
  2. dynamic event
)

Implementation

SwipeFeedState<T> swipeFeedStateReducer<T>(SwipeFeedState<T> state, dynamic event){
  if(event is SwipeFeedEvent){
    if(event is ResetEvent){
      return SwipeFeedState(
        items: [Tuple2(null, SwipeFeedCardState.tower())],
        previousPolls: [],
        pageToken: null,
        noMoreItems: state.noMoreItems,
        connectivityError: state.connectivityError,
        loader: state.loader,
        hasMore: true,
        loading: false
      );
    }
    return SwipeFeedState(
      items: setItemsReducer(state, event),
      pageToken: setPageTokenReducer(state, event),
      previousPolls: setPreviousPollsReducer(state, event),
      loading: setLoadingReducer(state, event),
      hasMore: setHasMoreReducer(state, event),
      connectivity: setConnectivityReducer(state, event),
      noMoreItems: state.noMoreItems,
      connectivityError: state.connectivityError,
      loader: state.loader,
    );
  }
  return state;
}