Creates a future completed with value
.
If value
is a future, the created future waits for the value
future to complete, and then completes with the same result. Since a value
future can complete with an error, so can the future created by Future.value, even if the name suggests otherwise.
If value
is not a Future, the created future is completed with the value
value, equivalently to new Future<T>.sync(() => value)
.
Use Completer to create a future and complete it later.
factory Future.value([FutureOr<T> value]) { return new _Future<T>.immediate(value); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-async/Future/Future.value.html