Skip to content

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android.

License

Notifications You must be signed in to change notification settings

adarshjayan7574/FitKit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FitKit

pub package

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android. Currently only supports reading heart rate, step count, distance walked, calories burned, water drank, height and weight.

Usage

To use this plugin, add fit_kit as a dependency in your pubspec.yaml file.

Getting Started

Android

Enable Fitness API and obtain an OAuth 2.0 client ID.

iOS

Enable HealthKit and add NSHealthShareUsageDescription key to the Info.plist file.

Sample Usage

If you're using more than one DataType it's advised to call requestPermissions before, otherwise iOS HealthKit will ask to approve every permission one by one in separate screens.

import 'package:fit_kit/fit_kit.dart';

void read() async {
    final results = await FitKit.read(
        DataType.HEART_RATE,
        DateTime.now().subtract(Duration(days: 5)),
        DateTime.now(),
    );
}

void readAll() async {
    if (await FitKit.requestPermissions(DataType.values)) {
      for (DataType type in DataType.values) {
        final results = await FitKit.read(
          type,
          DateTime.now().subtract(Duration(days: 5)),
          DateTime.now(),
        );
      }
    }
}

About

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 36.1%
  • Swift 36.1%
  • Dart 14.8%
  • Ruby 11.6%
  • Objective-C 1.4%