Flutter 运行时错误:无效参数(dartObject):无法转换:“LatLng”实例

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

在使用 dart 的 Flutter 应用程序中,使用以下代码向 Firebase Firestore 对象添加字段时:

     geolocation: LatLng(latitude, longitude),

我收到以下运行时错误:

无效参数(dartObject):无法转换:“LatLng”实例

flutter dart google-cloud-firestore geolocation flutterflow
1个回答
0
投票

解决方案是使用 GeoPoint 构造函数:

     geolocation: GeoPoint(latitude, longitude),
© www.soinside.com 2019 - 2024. All rights reserved.