ScheduleAtStop.fromJson constructor

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

Creates a new ScheduleAtStop from a JSON object.

Implementation

factory ScheduleAtStop.fromJson(Map<String, dynamic> json) {
  return ScheduleAtStop(
    arrivals: ((json[ApiFields.scheduleArrivals] as List?) ?? [])
        .map((arrival) => ScheduleArrival.fromJson(arrival))
        .toList(),
    stop: Stop.fromJson(json[ApiFields.stop] ?? {}),
  );
}