TechIsFun / nutrition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

License:MIT License


Languages

Language:C++ 25.9%Language:Kotlin 23.3%Language:Dart 12.6%Language:CMake 12.2%Language:Swift 11.2%Language:Ruby 6.6%Language:HTML 6.1%Language:C 1.1%Language:Objective-C 1.1%