将 LatLng 数据转换为字符串地址位置,谷歌地图

问题描述 投票:0回答:0

我无法将标记的 LatLng 位置从谷歌地图转换为我的 flutter 应用程序上的地址字符串。运行时,我的应用程序上显示了 LatLng 数据,它从 firebase 后端 latlng 获取数据。但是我找不到将其转换为地址的方法。我尝试使用地理定位器和地理编码但找不到方法。

这是我的 latlng 位置输出代码:

Align(
  alignment: AlignmentDirectional(0.0, 0.0),
  child: AutoSizeText(
           widget.location!.location!
             .toString()
             .maybeHandleOverflow(maxChars: 20),
  textAlign: TextAlign.start,
  style: FlutterFlowTheme.of(context)
            .subtitle1
            .override(
              fontFamily: 'Poppins',
              fontSize: 18.0,
             ),
 ),
),

(https://i.stack.imgur.com/AeDgS.jpg) 希望任何人都可以给我一些关于如何解决这个问题的提示,谢谢。

我尝试使用地理编码,代码如下:

widget.location!.latitude!, widget.location!.longitude!);

但是收到这行代码的错误,MapRecord 中没有定义纬度和经度

flutter google-maps geocoding latitude-longitude
© www.soinside.com 2019 - 2024. All rights reserved.