Schedule.fromMap constructor
Implementation
factory Schedule.fromMap(Map<String, dynamic> map) {
return Schedule(
season: int.parse(map["season"]),
round: int.parse(map["round"]),
url: map["url"],
raceName: map["raceName"],
circuit: Circuit.fromMap(map["Circuit"]),
dateTime: DateTime.parse("${map["date"]} ${map["time"]}"),
firstPractice: FirstPractice.fromMap(map["FirstPractice"]),
sprint: map.containsKey("Sprint") ? Sprint.fromMap(map["Sprint"]) : null,
secondPractice: map.containsKey("SecondPractice")
? SecondPractice.fromMap(map["SecondPractice"])
: null,
thirdPractice: map.containsKey("ThirdPractice")
? ThirdPractice.fromMap(map["ThirdPractice"])
: null,
qualifying: Qualifying.fromMap(map["Qualifying"]),
);
}