getAircraftImageByRegistration method
Aircraft image by tail-number (BETA) TIER 2
What is the aircraft photo? Aircraft images are being searched in external sources by certain criteria without any manual intervention. Therefore, false matches may be returned. Only images with licenses approved for commercial use are returned. Please be advised that you may be required to mention author attribution before using the image. Returns: Image data with medium-sized direct image URL and licence approved for commercial use is returned.
Parameters:
- String reg (required): Tail-number of the aircraft (full, stripped and any case formats are acceptable).
Implementation
Future<ResourceContract?> getAircraftImageByRegistration(
String reg,
) async {
final response = await getAircraftImageByRegistrationWithHttpInfo(
reg,
);
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),
'ResourceContract',
) as ResourceContract;
}
return null;
}