onCancel method
void
onCancel(
- void callback()
Register a callback to be invoked when the token is cancelled. If the token is already cancelled, the callback is invoked immediately.
Implementation
void onCancel(void Function() callback) {
if (_isCancelled) {
callback();
} else {
_listeners.add(callback);
}
}