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