Home > Back-end >  How to upload a custom data model in firestore flutter
How to upload a custom data model in firestore flutter

Time:07-03

I am using firestore for some task and i have a custom model of product and i want to push that data in that specific model in firestore but didn't get any success

CodePudding user response:

Convert your model into map and upload the map instead. You will not be able to upload custom objects to Firestore. You can convert your model into map using something like this, where foo and bar are fields of your custom object:

Map<String, dynamic> getMap() {
  return {
    'foo': foo,
    'bar': bar
  };
}
  • Related