onError method

  1. @visibleForOverriding
void onError(
  1. AsyncError<T> value, {
  2. bool seamless = false,
})
inherited

Life-cycle for when an error from the provider's "build" method is received.

Might be invokved after the element is disposed in the case where provider.future has yet to complete.

Implementation

@visibleForOverriding
void onError(AsyncError<T> value, {bool seamless = false}) {
  if (mounted) {
    asyncTransition(value, seamless: seamless);
  }

  final completer = _futureCompleter;
  if (completer != null) {
    completer
      // TODO test ignore
      ..future.ignore()
      ..completeError(
        value.error,
        value.stackTrace,
      );
    _futureCompleter = null;
    // TODO SynchronousFuture.error
  } else if (mounted) {
    futureNotifier.result = Result.data(
      // TODO test ignore
      Future.error(
        value.error,
        value.stackTrace,
      )..ignore(),
    );
  }
}