toJson method

Map<String, dynamic> toJson()

Map representation of this VroomVehicle object having keys: 'id', 'profile', 'description', 'start', 'start_index', 'end', 'end_index', 'capacity', 'skills', 'time_window', 'breaks', 'speed_factor', 'max_tasks' and 'steps'.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'profile': profile,
      'description': description,
      'start': start?.toList(),
      'start_index': startIndex,
      'end': end?.toList(),
      'end_index': endIndex,
      'capacity': capacity,
      'skills': skills,
      'time_window': timeWindow,
      'breaks': breaks == null
          ? null
          : breaks!
              .map<Map<String, dynamic>>((VroomVehicleBreak b) => b.toJson())
              .toList(),
      'speed_factor': speedFactor,
      'max_tasks': maxTasks,
      'steps': steps == null
          ? null
          : steps!
              .map<Map<String, dynamic>>(
                  (VroomVehicleStep step) => step.toJson())
              .toList(),
    }..removeWhere((key, value) => value == null);