onData method

  1. @internal
void onData(
  1. AsyncData<T> value, {
  2. bool seamless = false,
})
inherited

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

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

Implementation

@internal
void onData(AsyncData<T> value, {bool seamless = false}) {
  if (mounted) {
    asyncTransition(value, seamless: seamless);
  }

  final completer = _futureCompleter;
  if (completer != null) {
    completer.complete(value.value);
    _futureCompleter = null;
  } else if (mounted) {
    futureNotifier.result = Result.data(Future.value(value.value));
  }
}