useFuture<T> function

AsyncSnapshot<T> useFuture <T>(Future<T> future, { T initialData, bool preserveState: true })

Subscribes to a Future and return its current state in an AsyncSnapshot.

  • preserveState defines if the current value should be preserved when changing the Future instance.

See also:

Implementation

AsyncSnapshot<T> useFuture<T>(Future<T> future,
    {T initialData, bool preserveState = true}) {
  return Hook.use(_FutureHook(future,
      initialData: initialData, preserveState: preserveState));
}