CancellationToken constructor

CancellationToken([
  1. bool canceled = false
])

Creates a CancellationToken that can be canceled.

Tokens created with this constructor will remain in the canceled state specified by the canceled parameter. If canceled is false, both canBeCanceled and isCancellationRequested will be false.

Implementation

factory CancellationToken([bool canceled = false]) => CancellationToken._(
      canceled ? CancellationTokenSource._canceledSource : null,
    );