Nutrition for Flutter

Google Fit and Apple Health Wrapper

Pub Version License: MIT

✨ 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.

Libraries

nutrition
nutrition_enum