nextPage method

Future<void> nextPage()

Implementation

Future<void> nextPage() async {
  if (_state.value == _ListUicState.progressNextPage) {
    return;
  }
  _state.value = _ListUicState.progressNextPage;
  await _loadItems(_page + 1).then((result) {
    if (result.isNotEmpty) {
      List<T> newItems = _items.value;
      newItems.addAll(result);
      _items.value = newItems;
      _page++;
    }
    _state.value = _ListUicState.data;
  }).catchError((error) {
    _state.value = _ListUicState.error;
  });
}