fetch method

Future<T?> fetch({
  1. bool resetValue = false,
})

Implementation

Future<T?> fetch({bool resetValue = false}) async {
  if (resetValue) {
    this.resetValue();
  }
  _emit(const AsyncLoading());
  try {
    final data = await _future();
    _emit(AsyncData(data));
    return data;
  } catch (e, st) {
    _emit(AsyncError(e, st));
  }
  return null;
}