toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      'type': kType,
      'mission_id': missionId,
      'status': MissionStatusCodec.toWire(status),
      'timestamp': timestamp.toIso8601String(),
      if (stepIndex != null) 'step_index': stepIndex,
      if (error != null) 'failure_reason': error,
      if (error != null) 'error': error,
      if (goal != null && goal!.trim().isNotEmpty) 'goal': goal!.trim(),
      if (stepsCompleted != null) 'steps_completed': stepsCompleted,
      if (stepsTotal != null) 'steps_total': stepsTotal,
      if (stepsSkipped != null) 'steps_skipped': stepsSkipped,
      if (stepsFailed != null && stepsFailed!.isNotEmpty)
        'steps_failed': stepsFailed,
      if (requestedStableId != null && requestedStableId!.isNotEmpty)
        'requested_stable_id': requestedStableId,
      if (requestedText != null && requestedText!.isNotEmpty)
        'requested_text': requestedText,
      if (actedStableId != null && actedStableId!.isNotEmpty)
        'acted_stable_id': actedStableId,
    };