throwIfDisposing method
Throws StateError while the core unwinds the cleanup stack.
The body is gone and the outcome is decided, so nothing of the body
runs any more: a disposer takes what it needs from its closure and
asks job.isCancelled about the outcome. Reads go through this one
alone — after the job has finished they stay legal, as they were.
Implementation
@protected
void throwIfDisposing(String action) {
if (_owner.isDisposing) {
throw StateError('$_owner is cleaning up after its body, cannot $action');
}
}