Vehicle.fromJson constructor
Constructs a new Vehicle instance from a map.
This constructor is typically used for constructing a new Vehicle instance from a JSON object that has been deserialized into a map. The map keys correspond to the property names of Vehicle and the map values are the respective values of these properties.
Implementation
factory Vehicle.fromJson(Map<String, dynamic> json) {
return Vehicle(
id: json['id'],
userId: json['user_id'],
vehicleId: json['vehicle_id'],
vin: json['vin'],
displayName: json['display_name'],
optionCodes: json['option_codes'],
color: json['color'],
tokens: json['tokens'] != null ? List<String>.from(json['tokens']) : null,
state: json['state'],
inService: json['in_service'],
idS: json['id_s'],
calendarEnabled: json['calendar_enabled'],
backseatToken: json['backseat_token'],
backseatTokenUpdatedAt: json['backseat_token_updated_at'],
guiSettings: json['gui_settings'] != null
? GuiSettings.fromJson(json['gui_settings'])
: null,
vehicleState: json['vehicle_state'] != null
? VehicleState.fromJson(json['vehicle_state'])
: null,
climateState: json['climate_state'] != null
? ClimateState.fromJson(json['climate_state'])
: null,
chargeState: json['charge_state'] != null
? ChargeState.fromJson(json['charge_state'])
: null,
driveState: json['drive_state'] != null
? DriveState.fromJson(json['drive_state'])
: null,
vehicleConfig: json['vehicle_config'] != null
? VehicleConfig.fromJson(json['vehicle_config'])
: null,
);
}