General topic questions
Task Cancellation
MediumLess common
Free section · general topics & algorithms
How does cooperative cancellation work with Task.checkCancellation()?
Reveal model answer
Canceling a Task sets isCancelled; work must check periodically or use cancellable APIs. throw CancellationError via checkCancellation(). Parents cancel children in structured concurrency.