onCancel method

  1. @override
void onCancel(
  1. Exception cancelException
)

Called when the attached token is cancelled.

It's not necessary to detach from the token in this method, as cancellation tokens detach from all cancellables automatically when cancelled.

Implementation

@override
void onCancel(Exception cancelException) {
  hasBeenCancelled = true;
  _process?.kill(ProcessSignal.sigkill);
  progress.cancel();
  super.onCancel(cancelException);
}