SingleTripResponse.fromJson constructor
SingleTripResponse.fromJson(
- Map<String, dynamic> json
)
Implementation
SingleTripResponse.fromJson(Map<String, dynamic> json) {
appTripId = (json["appTripId"] ?? "");
tripId = (json["tripId"] ?? 0);
userId = json["userId"] ?? 0;
isCoPassenger = json["isCoPassenger"] ?? false;
tripStartMode = json["tripStartMode"];
startLocation = json["startLocation"] == null
? null
: LocationModelResponse.fromJson(json["startLocation"]);
startTime = json["startTime"];
totalDistance = json["totalDistance"];
tripDuration = double.parse(
(json["tripDuration"] ?? json["duration"] ?? 0).toString(),
);
endLocation = json["endLocation"] == null
? null
: LocationModelResponse.fromJson(json["endLocation"]);
endTime = json["endTime"];
overallTripScore = json["overallTripScore"];
tripScoringStatus = json['tripScoringStatus'] == null
? null
: TripScoringStatus.values.firstWhere((element) {
return element.value.toLowerCase() ==
json['tripScoringStatus'].toLowerCase();
});
extraKeys = json["extraKeys"] == null
? null
: TripExtraKeys.fromJson(json["extraKeys"]);
clientTripExtras = json["clientTripExtras"] == null
? null
: ClientTripExtras.fromJson(json["clientTripExtras"]);
vehicleType = json["vehicleType"];
extraTripScores = json["extraTripScores"];
}