The type of the value that the Promise will resolve to.
The Promise instance created by the Future.
Use this to await the result or attach .then() / .catch() handlers.
Rejects the Promise created by the Future.
Optionalreason: unknownThe reason for rejecting the Promise. Typically an Error object.
Resolves the Promise created by the Future.
A tiny way to make
Promisemore convenient to use without any dependencies.Create a new Future which wraps a new
Promise, allowing you to resolve or reject it from outside the executor.Inspired by C#
TaskCompletionSource.Example: Basic usage
Example: With async/await
Example: Error handling