loadData method

Future<void> loadData()

Overridable method that handles data load from the service.

Implementation

Future<void> loadData() async {
  emit(RequestState.loading(state.value));

  try {
    emit(RequestState.loaded(await fetchData()));
  } catch (e) {
    emit(RequestState.error(e.toString()));
  }
}