在 firestore 文档/地理定位器包中保存 LatLng(geopoint) 值

save LatLng(geopoint) value in firestore document / geolocator package

我是 flutter 的新手,我需要在我的用户文档中保存一个值。 我可以打印这些值,但我不知道如何将 LatLan 的值分配给变量并将它们保存在 firestore 中。 这是我的 searchMapPlaceWidget returns 它们的值

 SearchMapPlaceWidget(
   darkMode: true,
   placeType: PlaceType.establishment,
   language: 'se',
   apiKey: kGoogleApiKey,
   onSelected: (place) async {
     final geolocation =
       await place.geolocation;

     final chosenPlace = Marker(
       markerId: MarkerId(
         'chosen-location'),
       icon: BitmapDescriptor
       .defaultMarker,
       position:
       geolocation.coordinates);
     GoogleMapController controller =
       await _mapController.future;
     setState(() {
       _markers.add(chosenPlace);
     });
     print(chosenPlace.position);

     controller.animateCamera(
       CameraUpdate.newLatLng(
         geolocation.coordinates));
     controller.animateCamera(
       CameraUpdate.newLatLngBounds(
         geolocation.bounds, 50));
   },

 ),

这是我编写的函数,它不起作用

static void addGeoPoint(User user)async{
var pos = await location.getLocation();
GeoFirePoint point = geo.point(latitude: pos.latitude, longitude: pos.longitude);
return usersRef.document(user.id).updateData({
  'myAddress' : point.data
});

}

如何保存 'chosenPlace' 的位置值?

谢谢大家

解决了。

 GeoFirePoint myLocation = geo.point(latitude: _location.latitude, longitude: _location.longitude);
                                              usersRef.document(widget.user.id).updateData({
                                                'position' : myLocation.data