VroomVehicleBreak.fromJson constructor

VroomVehicleBreak.fromJson(
  1. Map<String, dynamic> json
)

Generates a VroomVehicleBreak from a Map having keys matching the Vroom API Vehicle Break model that includes:

'id', 'time_windows', 'service', and 'description'.

Implementation

factory VroomVehicleBreak.fromJson(Map<String, dynamic> json) =>
    VroomVehicleBreak(
      id: json['id'],
      timeWindows: json['time_windows'] == null
          ? null
          : (json['time_windows'] as List<dynamic>)
              .map<List<int>>(
                (dynamic timeWindow) => (timeWindow as List<dynamic>)
                    .map<int>((dynamic time) => time as int)
                    .toList(),
              )
              .toList(),
      service: json['service'] ?? 0,
      description: json['description'],
    );