loadItems method

Future<void> loadItems()

Implementation

Future<void> loadItems() async {
  if (isClosed) return;
  emit(ListLoading<T>());

  try {
    final items = await fetchItems();
    if (isClosed) return;
    emit(createLoadedState(items));
  } catch (e) {
    if (isClosed) return;
    emit(ListError<T>(error: ErrorMapper.map(e)));
  }
}