runErrorFuture<T> method Null safety

Future<T> runErrorFuture<T>(
  1. Future<T> future,
  2. {Object? key,
  3. bool throwException = false}
)

Implementation

Future<T> runErrorFuture<T>(Future<T> future,
    {Object? key, bool throwException = false}) async {
  try {
    _setErrorForModelOrObject(null, key: key);
    return await future;
  } catch (e) {
    _setErrorForModelOrObject(e, key: key);
    onFutureError(e, key);
    if (throwException) rethrow;
    return Future.value();
  }
}