JobBase<T> constructor

JobBase<T>({
  1. Object? key,
  2. String describe()?,
  3. bool cancellable = true,
  4. Duration? timeout,
  5. JobObserver? observer,
})

Creates a job that has not started yet.

The named parameters are those of Job.new, timeout included, and so are the errors: ArgumentError for a timeout that is zero or negative, or that comes with cancellable: false.

Implementation

JobBase({
  Object? key,
  String Function()? describe,
  bool cancellable = true,
  Duration? timeout,
  JobObserver? observer,
}) : _timeout = _checkTimeout(timeout, cancellable: cancellable),
     _timeoutTrace = timeout == null ? null : StackTrace.current,
     _key = key,
     _describe = describe,
     _cancellable = cancellable,
     _observer = observer {
  _builtOnCore[this] = true;
}