ShuttleUpdate.fromJson constructor
Implementation
factory ShuttleUpdate.fromJson(Map<String, dynamic> json) {
return ShuttleUpdate(
id: json['id'],
trackerId: json['tracker_id'],
heading: (json['heading'] as num).toDouble(),
speed: json['speed'],
time: json['time'],
created: json['created'],
vehicleId: json['vehicle_id'],
routeId: json['route_id'] ?? -1, // -1 instead of null
latitude: json['latitude'],
longitude: json['longitude'],
);
}