toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() => {
      'id': id,
      'name': name,
      'state': state.name,
      if (queue != null) 'queue': queue,
      if (workerId != null) 'worker_id': workerId,
      if (args != null) 'args': args,
      if (kwargs != null) 'kwargs': kwargs,
      if (result != null) 'result': result,
      if (error != null) 'error': error,
      'retries': retries,
      'max_retries': maxRetries,
      if (runtimeMs != null) 'runtime_ms': runtimeMs,
      if (sentAt != null) 'sent_at': sentAt!.toUtc().toIso8601String(),
      if (receivedAt != null)
        'received_at': receivedAt!.toUtc().toIso8601String(),
      if (startedAt != null)
        'started_at': startedAt!.toUtc().toIso8601String(),
      if (finishedAt != null)
        'finished_at': finishedAt!.toUtc().toIso8601String(),
      'updated_at': updatedAt.toUtc().toIso8601String(),
    };