fetchDataJoin method

dynamic fetchDataJoin(
  1. String url,
  2. List<InfiniteScrollPODO> oldData
)

Implementation

fetchDataJoin(String url, List<InfiniteScrollPODO> oldData) async {
  try {
    List<InfiniteScrollPODO> data = await dataRepo.fetchData(url, nextPage);
    final newData = [...oldData, ...data];
    this.emit(FetchDataState.loaded(newData));
    incrementPage();
  } catch (e) {
    this.emit(FetchDataState.error(
      generic: 'An error occurred, please try again',
    ));
  }
}