future property

  1. @override
AlwaysAliveRefreshable<Future<T>> future
latefinal

Obtains a Future that resolves with the first state value that is not AsyncLoading.

This future will not necessarily wait for AsyncNotifier.build to complete. If state is modified before AsyncNotifier.build completes, then future will resolve with that new state value.

The future will fail if state is in error state. In which case the error will be the same as AsyncValue.error and its stacktrace.

Listening to this using Ref.watch will rebuild the widget/provider when the AsyncNotifier emits a new value. This will then return a new Future that resoles with the latest "state".

Implementation

@override
late final AlwaysAliveRefreshable<Future<T>> future = _asyncFuture<T>(this);