AuthorizationFlight.fromJson constructor
AuthorizationFlight.fromJson(
- Object? json
Implementation
factory AuthorizationFlight.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return AuthorizationFlight(
departureAt: map['departure_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['departure_at'] as int).toInt()),
passengerName: map['passenger_name'] == null
? null
: (map['passenger_name'] as String),
refundable:
map['refundable'] == null ? null : (map['refundable'] as bool),
segments: map['segments'] == null
? null
: (map['segments'] as List<Object?>)
.map((el) => AuthorizationSegmentsItem.fromJson(el))
.toList(),
travelAgency: map['travel_agency'] == null
? null
: (map['travel_agency'] as String),
);
}