getRoutes method

Future<Map<String, BusRoute>> getRoutes ()

Returns a Map of <BusRoute.routeShortName, BusRoute> pairs.

Implementation

Future<Map<String, BusRoute>> getRoutes() async {
  var response = await fetch('busRoutes',
      query: {'query': '{"route_id": ["87-184","286-184","289-184"]}'});

  Map<String, BusRoute> routeMap = response != null
      ? Map.fromIterable(json.decode(response.body),
          key: (json) => json['route_short_name'],
          value: (json) => BusRoute.fromJson(json))
      : {};
  return routeMap;
}