getAirportSolarTime method
- AirportCodesByEnum codeType,
- String code, {
- DateTime? dateLocal,
Solar and day time at the airport TIER 1
What is the sun position in the sky now at a specific time at the airport? or When does the sun rise and set at the airport today or on the other day at the airport? or Is it dark now or is it day at the airport? At the moment airports having both ICAO and IATA code are present in database only. Returns: If airport is found, returns various solar-related information: sun position in the sky, daytime (day, night, twilight: civil, nautical, astronomical, golden/blue hours), sunrise and sunset times, etc.
Parameters:
-
AirportCodesByEnum codeType (required): Type of code to search airport by (
iataoricao) -
String code (required): If
codeTypeis: *icao, then this field must be a 4-character ICAO-code of the airport (e.g.: EHAM, KLAX, UUEE, etc.); *iata, then this field must be a 3-character IATA-code of the airport (e.g.: AMS, SFO, LAX, etc.). Full, stripped and any case formats are acceptable. -
DateTime dateLocal: The moment of time which solar data is request for (local time, format: YYYY-MM-DDTHH:mm). Default - current time.
Implementation
Future<SolarStateContract?> getAirportSolarTime(
AirportCodesByEnum codeType,
String code, {
DateTime? dateLocal,
}) async {
final response = await getAirportSolarTimeWithHttpInfo(
codeType,
code,
dateLocal: dateLocal,
);
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),
'SolarStateContract',
) as SolarStateContract;
}
return null;
}