getFromLocationPreAndroidApi33 method
Provides an array of Addresses that attempt to describe the area immediately surrounding the given latitude and longitude.
Note: this method has been deprecated in Android API 33 as it can result in blocking the main thread. On Android devices running API 33 or higher please use the Geocoder.getFromLocation method.
Implementation
Future<List<Address?>?> getFromLocationPreAndroidApi33(
double latitude,
double longitude,
int maxResults,
) async {
final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec =
_pigeonVar_codecGeocoder;
final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger;
const String pigeonVar_channelName =
'dev.flutter.pigeon.geocoding_android.Geocoder.getFromLocationPreAndroidApi33';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel
.send(<Object?>[this, latitude, longitude, maxResults]);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return (pigeonVar_replyList[0] as List<Object?>?)?.cast<Address?>();
}
}