This is my way
foods[foods.indexWhere((element) => element.uid == food.uid)] = food;
some validation should be applied to avoid any null reference issues
This is my way
foods[foods.indexWhere((element) => element.uid == food.uid)] = food;
some validation should be applied to avoid any null reference issues