stop method

Future<void> stop({
  1. bool graceful = true,
})

Stop the worker (for background workers)

Implementation

Future<void> stop({bool graceful = true}) async {
  if (graceful) {
    await _gracefulShutdown();
    await _shutdownCompleter.future;
  } else {
    _shouldStop = true;
    _workerTimer?.cancel();
    _shutdownCompleter.complete();
  }
}