create static method

QueueJob create(
  1. String jobType,
  2. Map<String, dynamic> json
)

Create a job instance from its type name and JSON data

Throws QueueException if the job type is not registered.

Implementation

static QueueJob create(String jobType, Map<String, dynamic> json) {
  final factory = _instance._factories[jobType];
  if (factory == null) {
    throw QueueException(
      'Job type "$jobType" is not registered. '
      'Register it with QueueJobRegistry.register() before dispatching.',
    );
  }
  return factory(json);
}