create<T extends Object, R extends Object?> abstract method
CancellationToken<T, R?>
create<T extends Object, R extends Object?>({})
creates a unique CancellationToken
which then can be used to
either cancel it or get the value
token
will be used later to get the CancellationToken
operation
the operation that returns the result of R
onCancel
an optional additional mechanism when CancellationToken.cancel
is called
Implementation
CancellationToken<T, R?> create<T extends Object, R extends Object?>({
required T token,
required Future<R> operation,
FutureOr<void> Function()? onCancel,
});