getStops method

Future<List<BusStop>> getStops ()

Returns a List of BusStop objects.

Implementation

Future<List<BusStop>> getStops() async {
  var response = await fetch('busStops',
      query: {'query': '{"route_id": ["87-184","286-184","289-184"]}'});

  List<BusStop> stopsList = response != null
      ? json
          .decode(response.body)
          .map<BusStop>((json) => BusStop.fromJson(json))
          .toList()
      : [];
  return stopsList;
}