fetchBusPositionsForRouteAndLocation function

Future<List<BusPosition>> fetchBusPositionsForRouteAndLocation(
  1. String apiKey, {
  2. required String routeId,
  3. required double latitude,
  4. required double longitude,
  5. required double radiusMeters,
})

Fetches bus positions for a specific route and location.

apiKey is your API key for the WMATA API.

routeId is the base route name as shown on the bus. Note that the base route name could also refer to any variant, so a RouteID of 10A could refer to 10A, 10Av1, 10Av2, etc.

latitude is the last reported Latitude of the bus.

longitude is the last reported Longitude of the bus.

radiusMeters is the radius, in meters, to include in the search area.

Implementation

Future<List<BusPosition>> fetchBusPositionsForRouteAndLocation(
  String apiKey, {
  required String routeId,
  required double latitude,
  required double longitude,
  required double radiusMeters,
}) async =>
    await BusPositionService.fetchBusPositions(
      apiKey,
      routeId: routeId,
      lat: latitude,
      lon: longitude,
      radius: radiusMeters,
    );