CancellationToken constructor

CancellationToken([
  1. bool? canceled
])

Creates a CancellationToken that can be canceled.

Implementation

factory CancellationToken([bool? canceled]) {
  if (canceled == null || canceled == false) {
    return const CancellationToken._();
  }

  return CancellationToken._(CancellationTokenSource.canceledSource);
}