getFromLocationNamePreAndroidApi33 method

Future<List<Address?>?> getFromLocationNamePreAndroidApi33(
  1. String locationName,
  2. int maxResults,
  3. GeographicBounds? bounds
)

Returns an array of Addresses that attempt to describe the named location, which may be a place name such as "Dalvik, Iceland", an address such as "1600 Amphitheatre Parkway, Mountain View, CA", an airport code such as "SFO", and so forth.

Additional bounds can be specified to describe a geographical box to which the search area will be limited.

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?>?> getFromLocationNamePreAndroidApi33(
  String locationName,
  int maxResults,
  GeographicBounds? bounds,
) async {
  final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec =
      _pigeonVar_codecGeocoder;
  final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger;
  const String pigeonVar_channelName =
      'dev.flutter.pigeon.geocoding_android.Geocoder.getFromLocationNamePreAndroidApi33';
  final BasicMessageChannel<Object?> pigeonVar_channel =
      BasicMessageChannel<Object?>(
    pigeonVar_channelName,
    pigeonChannelCodec,
    binaryMessenger: pigeonVar_binaryMessenger,
  );
  final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel
      .send(<Object?>[this, locationName, maxResults, bounds]);
  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?>();
  }
}