Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nohli/mindful_minutes
https://github.com/nohli/mindful_minutes
dart flutter hacktoberfest healthkit ios
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nohli/mindful_minutes
- Owner: nohli
- License: bsd-3-clause
- Created: 2022-07-05T23:10:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T05:47:33.000Z (about 2 months ago)
- Last Synced: 2024-10-12T05:44:14.741Z (about 1 month ago)
- Topics: dart, flutter, hacktoberfest, healthkit, ios
- Language: Dart
- Homepage: https://pub.dev/packages/mindful_minutes
- Size: 267 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Features
Plugin for writing mindful minutes to Apple Health on iOS.
Features:
* Check for write permission
* Request write permission
* Write mindful minutesThis works on iOS 12 (other pub.dev health plugins require a higher iOS version, so I created my own).
## Getting started
* Add to pubspec.yaml
* Use plugin in your code (see examples of all methods below)
* Add permission for [NSHealthShareUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nshealthshareusagedescription) and [NSHealthUpdateUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nshealthupdateusagedescription) to `ios/Runner/info.plist`:```
NSHealthShareUsageDescription
This app would like to access mindful minutes.
NSHealthUpdateUsageDescription
This app would like to save mindful minutes.
```## Usage
```dart
const _plugin = MindfulMinutesPlugin();final bool hasPermission = await _plugin.checkPermission();
final bool hasPermission = await _plugin.requestPermission();
await _plugin.writeMindfulMinutes(startTime, endTime);
```## Important
iOS will ask the user only once per app for granting permissions. If the user disables it from iOS settings, it needs to be enabled from iOS settings.