getAllAirportDelays method

Future<AirportDelayContract?> getAllAirportDelays({
  1. DateTime? dateUtc,
})

Global delays (current or historical moment) TIER 3

What is the current or historical delay situation in all airports? or What is the delay index of all airports globally right now or at a moment in past? Please read more about airport delays on here: https://aerodatabox.com/api-airport-delays/ Returns: Statistical delay information about delays (median delay, delay index, cancelled flights) of arrivals and departures for all known airports, represented by a collection of items sorted by the average of arrival and departure index, descending order (from worst to best). Only qualifying and recent enough delay statistics records are returned.

Parameters:

  • DateTime dateUtc: The moment of time for / from which delay data is requested (UTC time, format: YYYY-MM-DDTHH:mm). Default - current time.

Implementation

Future<AirportDelayContract?> getAllAirportDelays({
  DateTime? dateUtc,
}) async {
  final response = await getAllAirportDelaysWithHttpInfo(
    dateUtc: dateUtc,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty &&
      response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'AirportDelayContract',
    ) as AirportDelayContract;
  }
  return null;
}