fetchSchedule static method
Implementation
static Future<Schedule> fetchSchedule(
String apiKey, {
required String routeId,
String? date,
bool? includingVariations,
}) async {
final String host = _buildUrl(
routeId: routeId,
date: date,
includingVariations: includingVariations,
);
final response = await http.get(
Uri.parse(host),
headers: {"api_key": apiKey},
);
Map<String, dynamic> responseArr = readJson(response.body);
if (responseArr.isEmpty) return const Schedule.empty();
return Schedule.fromJson(responseArr);
}