addJob method Null safety

void addJob(
  1. AsyncJob job,
  2. {int retryTime = 1}
)

Add new job into the queue

retryTime set the time that this job should retry if failed default to 1 setting retryTime does not make the job auto retry you must explicitly call retry when adding job.

Implementation

void addJob(AsyncJob job, {int retryTime = 1}) {
  if (isClosed) {
    return _emitEvent(QueueEventType.violateAddWhenClosed);
  }

  final newNode = AsyncNode(job: job, maxRetry: retryTime);
  _enqueue(newNode);

  if (_autoRun) start();
}