Future<T>.syncValue constructor
- @Since("3.10")
- T value
Creates a future completed with value.
The future is guaranteed to not have an error.
If a synchronous computation can throw,
rather than doing Future.syncValue(computation()) and wrapping that in
a try/catch, you can use Future.sync which catches an error
into its returned future, as Future.sync(() => computation()).
Implementation
@Since("3.10")
factory Future.syncValue(T value) => _Future<T>().._setValue(value);