isCancelledSync method
Synchronously check whether the token has been cancelled.
Implementation
bool isCancelledSync({bool throwIfCancelled = false}) {
final ex = exception;
return (ex == null)
? false
: throwIfCancelled
? throw ex
: true;
}