Skip to content

I want to add list of objects to firestore document #1

Open
@hkotabi

Description

@hkotabi

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 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 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions