future_ext 1.1.0 future_ext: ^1.1.0 copied to clipboard
A tool to control `Future`.
ControllableFuture #
- Cancel the
Future
final controllable = ControllableFuture(() async {
/// some asynchronous code here,
}, onCancel: () {
// return an alternate value
});
// to wait
await controllable.future;
// to cancel
controllable.cancel();
Why not CancelableOperaion
in package:async
? #
It does not step out of the Future
on cancellation. It just ignores the Future
.
But this package actually cancels it.