future<T> method

AsyncValue<T> future<T>(
  1. Future<T> future
)

Consumes a Future and watches the given future.

Implemented by calling Future.asStream and forwarding calls onto stream.

If the given future changes, then the current StreamSubscription will be disposed and recreated for the new future. Thus, it is important that the future instance only changes when needed. It is incorrect to create a future in the same build as the future, unless you use something like memo to limit changes. Or, if possible, it is even better to wrap the future in an entirely new capsule (although this is not always possible).

Implementation

AsyncValue<T> future<T>(Future<T> future) => use.nullableFuture(future)!;