flutter_health 0.1.2 copy "flutter_health: ^0.1.2" to clipboard
flutter_health: ^0.1.2 copied to clipboard

outdated

AppleHealthKit library that support most of the values provided.

flutter_health #

Apple Health Kit library for Flutter that support most of the values provided.

Works on from iOS 11.0. Some data types are supported from iOS 12.2.

Dart package

Gitlab link

How to use #

Check if Apple Health is available on the device

await await FlutterHealth.checkIfHealthDataAvailable()

Request authorization for the data types supported by the plugin

await FlutterHealth.requestAuthorization()

Get the samples of data types authorized by the user within the given time range

await FlutterHealth.getBodyFat(startDate, endDate)
await FlutterHealth.getHeartRate(startDate, endDate)
await FlutterHealth.getBloodPressureSys(startDate, endDate)

...

Data will be returning as a List of an object called HKHealthData. This object has the following attributes:

 double value;
 String unit;
 int dateFrom;
 int dateTo;

Full Example #

 bool _isAuthorized = true;
 DateTime startDate = DateTime.utc(2018);
 DateTime endDate = DateTime.now();
 var _dataList = List<HKHealthData>();
 _isAuthorized = await FlutterHealth.requestAuthorization();
 if (_isAuthorized) _dataList.addAll(await FlutterHealth.getBodyFat(startDate, endDate));
 if (_isAuthorized) _dataList.addAll(await FlutterHealth.getHeight(startDate, endDate));
 setState(() {});
10
likes
0
pub points
18%
popularity

Publisher

unverified uploader

AppleHealthKit library that support most of the values provided.

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_health