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 map = await _channel.invokeMethod(
        PMConstants.mGetLatLngAndroidQ,
        <String, dynamic>{'id': entity.id},
      );

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