check method

  1. @override
  2. @mustCallSuper
void check()
override

Gives up if the job was cancelled, or if a rule its engine adds stopped holding.

solo, for example, gives up here once the rules of the job stopped holding.

join is the same thing around a call. Reach for check where there is no call to wrap: a loop over work of your own, a switch after one.

Legal after the job has finished, where it throws the Cancelled the job ended with, if any. While the core cleans up after the body it throws the cancellation of a cancelled job as well, so an action the body walked away from that polls check to stop sees the cancellation it waits for. On a job that is not cancelled it throws a StateError there instead: the body is gone, and no rule is asked for it any more.

Implementation

@override
@mustCallSuper
void check() {
  throwIfCancelled();
  throwIfDisposing('check');
}