Want to add an Object to Cloud Firestore using Flutter? first, i highly recommend you have a single file that defines all of your schemas and/or models so there’s a single point of reference for your db structure. like some file named dbSchema.dart:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import 'package:meta/meta.dart'; class Replies { final String title; final Map coordinates; Replies({ @required this.title, @required this.coordinates, }); Map<String, dynamic> toJson() => { 'title': title, 'coordinates': coordinates, }; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.