Flutter-Tutorials
Flutter-Tutorials copied to clipboard
I want to add list of objects to firestore document
Thank you for the great tutorial
what if ingredients are objects not string
I made ingredients data model
and in the food data model I defined
List<IngredientsModel> ingredients;
FoodModel.fromMap(Map<String, dynamic> data){
id = data[ID];
name = data[NAME];
categories = data[CATEGORIES];
}
Map<String, dynamic> toMap() {
return {
ID: id,
NAME:name,
CATEGORIES: categories,
};
}
I defined & filled a temporary list List<IngredientsModel> ingredientsTempList;
then I put values to food field food.ingredients = ingredientsTempList;
I found values in food.ingredients ex: print(food.ingredients[0].name)
when i save the product to firestore the screen hold, it doesn't save waiting for something?