ValhallaResponse.fromJson constructor

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

Implementation

factory ValhallaResponse.fromJson(Map<String, dynamic> json) {
  return ValhallaResponse._(
    trip: Trip.fromJson(json['trip']),
    alternates: json.containsKey('alternates')
        ? (json['alternates'] as List)
            .map((alternate) => Trip.fromJson(alternate['trip']))
            .toList()
        : null,
    id: json['id'],
  );
}