fetchNextTrains function

Future<List<NextTrain>> fetchNextTrains(
  1. String apiKey, {
  2. List<String>? stationCodes,
})

Fetches the next trains for the given station codes.

apiKey is your API key for the WMATA API.

If stationCodes is null, then all stations will be returned.

Implementation

Future<List<NextTrain>> fetchNextTrains(
  String apiKey, {
  List<String>? stationCodes,
}) async =>
    NextTrainsService.fetchNextTrains(
      apiKey,
      stationCodes: stationCodes == null ? 'All' : stationCodes.join(','),
    );