Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nohli/mindful_minutes


https://github.com/nohli/mindful_minutes

dart flutter hacktoberfest healthkit ios

Last synced: 19 days ago
JSON representation

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 minutes

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