getLatLngAsync method

Future<LatLng> getLatLngAsync(
  1. AssetEntity entity
)

Implementation

Future<LatLng> getLatLngAsync(AssetEntity entity) async {
  if (Platform.isAndroid) {
    final int version = int.parse(await getSystemVersion());
    if (version >= 29) {
      final Map<dynamic, dynamic>? map = await _channel.invokeMethod(
        PMConstants.mGetLatLngAndroidQ,
        <String, dynamic>{'id': entity.id},
      );

      // 将返回的数据传入map
      return LatLng(
        latitude: map?['lat'] as double?,
        longitude: map?['lng'] as double?,
      );
    }
  }
  return LatLng(latitude: entity.latitude, longitude: entity.longitude);
}