Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hkotabi opened this issue Feb 24, 2020 · 0 comments
Open

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

hkotabi opened this issue Feb 24, 2020 · 0 comments

Comments

@hkotabi
Copy link

hkotabi commented Feb 24, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant