How to store Geopoint to Firebase with Flutter

Viewed 427

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'),
))
1 Answers

Geopoint there is GeoPoint object inside Firestore plugin

'locationCoords':GeoPoint(_textEditingController5.GeoPoint.latitude,_textEditingController5.GeoPoint.longitude);
Related