token property
CancellationToken
get
token
Returns the cancellation token for the current task.
If a token was not specified when creating a task, an unmanaged
CancellationTokenSource is created and its token is returned.
By convention, each task has a token, but not all tokens are manageable.
Implementation
static CancellationToken get token {
final task = current;
task._token ??= CancellationTokenSource().token;
return task._token!;
}