See example
Supported Data Types |
---|
Total Fat |
Calcium |
Sugar |
Fiber |
Iron |
Potassium |
Sodium |
Vitamin A |
Vitamin C |
Protein |
Cholesterol |
Total Carbohydrates |
bool hasPermission = false;
await Nutrition.requestPermission().then((value) => setState(() {
hasPermission = value;
}));
Note for Android users you must have Google Sign In setup with your Flutter app
DateTime endDate = DateTime.now();
DateTime startDate = DateTime.now().subtract(Duration(days: 7));
Nutrition.getData(startDate, endDate);
Note for Android users you must have Google Sign In setup with your Flutter app
DateTime date = DateTime.now();
Map<NutritionEnum, double> nutrients = {
NutritionEnum.FIBRE: 10,
NutritionEnum.FAT: 5,
NutritionEnum.PROTEIN: 2.5,
NutritionEnum.CARBOHYDRATES: 100
};
// Pass a Map<NutritionEnum, double> and a date
Nutrition.addData(nutrients, date);
This project is MIT licensed.