How to store Geopoint to Firebase with Flutter
529
Geopoint there is GeoPoint object inside Firestore plugin
'locationCoords':GeoPoint(_textEditingController5.GeoPoint.latitude,_textEditingController5.GeoPoint.longitude);
Author by
user16034511
Updated on December 30, 2022Comments
-
user16034511 over 1 year
I have set up a Textformfield where users can fill in their shop & Geopoint coordinates.
They then press the submit button and it updates on our Firestore collection.
The problem I am having is how to save it as Geopoint's and not a string.
SizedBox(child: ElevatedButton( onPressed: () async { await collectionReference.add({ 'shopName': _textEditingController.text, 'address': _textEditingController2.text, 'description': _textEditingController3.text, 'thumbNail': _textEditingController4.text, 'locationCoords':_textEditingController5.GeoPoint },); }, chil:Text('Add Data'), ))
-
user16034511 almost 3 yearsThis worked Would I need to change my Text Controller as well? final _textEditingController5 = TextEditingController(); How do I allow it to accept coordinates?
-
Fatima ayaa almost 3 yearsaccording to your needs, the main thing is to recover longitude and attitude