Schedule.fromJson constructor

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

Creates a Schedule object from a JSON object.

Implementation

factory Schedule.fromJson(Map<String, dynamic> json) {
  return Schedule(
    direction0: (json[ApiFields.direction0] as List<dynamic>? ?? [])
        .map((direction) =>
            ScheduleDirection.fromJson(direction as Map<String, dynamic>))
        .toList(),
    direction1: (json[ApiFields.direction1] as List<dynamic>? ?? [])
        .map((direction) =>
            ScheduleDirection.fromJson(direction as Map<String, dynamic>))
        .toList(),
    name: json[ApiFields.name] ?? '',
  );
}