asError property

AsyncError<T>? asError

Upcast AsyncValue into an AsyncError, or return null if the AsyncValue is an AsyncLoading/AsyncData.

Note that an AsyncError may still be in loading state, such as during a pull-to-refresh.

Implementation

AsyncError<T>? get asError => map(
      data: (_) => null,
      error: (e) => e,
      loading: (_) => null,
    );