nutrition 1.0.0 nutrition: ^1.0.0 copied to clipboard
Flutter plugin which allows you to acess Google Fit and iOS Health nutrition data.
Nutrition for Flutter
Google Fit and Apple Health Wrapper
✨ Demo #
See example
🚀 Usage #
Supported Data Types |
---|
Total Fat |
Calcium |
Sugar |
Fiber |
Iron |
Potassium |
Sodium |
Vitamin A |
Vitamin C |
Protein |
Cholesterol |
Total Carbohydrates |
⚠️ Request Permission #
bool hasPermission = false;
await Nutrition.requestPermission().then((value) => setState(() {
hasPermission = value;
}));
🍎 Get Data #
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);
🍌 Add Data #
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);
📝 License #
This project is MIT licensed.