Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Health

Read and write health and fitness data from Apple Health on iOS and Google Health Connect on Android with one Flutter API.

Copy MarkdownOpen inOpen in GitHubView as MarkdownOpen in Scira AIOpen in ChatGPTOpen in ClaudeOpen in Cursor

The health plugin gives Flutter apps one API for reading and writing health and fitness data on both mobile platforms:

  • iOS: Apple Health, through Apple's HealthKit framework.
  • Android: Google Health Connect.
pub.devAPI referenceGitHub

Typical use cases:

App typeTypical data
FitnessWorkouts, steps, calories, activity levels
Health monitoringVital signs such as heart rate, blood pressure and oxygen levels
WellnessSleep, mindfulness, water intake, daily activities
MedicalBlood glucose, medications, symptoms, health measurements

Features

Reading data

  • Read individual data points.
  • Get time-bucketed aggregates (hourly, daily, weekly).
  • Fetch workout summaries.
  • Calculate step totals.
// Get last 24 hours of step data
final data = await health.getHealthDataFromTypes(
  types: [HealthDataType.STEPS],
  startDate: yesterday,
  endDate: now,
);

See Reading data.

Writing data

  • Write numeric health data.
  • Save workout sessions.
  • Log meals with nutrition information.
  • Record specialized data, such as ECG and audiograms.
// Save weight measurement
await health.writeHealthData(
  value: 70.5,
  type: HealthDataType.WEIGHT,
  startTime: DateTime.now(),
);

See Writing data.

Permissions

  • Request granular permissions per data type.
  • Check permission status.
  • Handle read and write access separately.
  • Use the platform-specific permission flows.
// Request read access
final granted = await health.requestAuthorization(
  [HealthDataType.STEPS],
  permissions: [HealthDataAccess.READ],
);

See Permissions.

Supported data

The plugin supports over 100 health data types, including:

CategoryData
ActivitySteps, distance, calories, workouts, flights climbed
Body measurementsWeight, height, BMI, body fat %, lean mass
Vital signsHeart rate, blood pressure, blood oxygen, temperature
NutritionMeals, water, calories, macros, micronutrients
SleepSleep stages, in bed time, asleep time, REM, deep sleep
ReproductiveMenstruation flow, cycle tracking

For every type, its unit and its platform availability, see Data types.

Platform support

PlatformHealth storeMinimum version
iOSApple Health (HealthKit)iOS 13.0
AndroidGoogle Health ConnectAndroid API level 26

Each platform needs its own configuration before you use the plugin:

Android setup

Configure Health Connect permissions and manifest settings.

iOS setup

Enable the HealthKit capability and add privacy descriptions.

How it works

  1. Set up your project

    Add the plugin to your pubspec.yaml and configure the platform-specific settings. See Installation.

  2. Request permissions

    Ask the user for permission to access specific health data types. See Permissions.

  3. Read or write data

    Use the Health API to read existing data or write new measurements. See Reading data and Writing data.

Example

Configure the plugin, request permission and read today's step count:

import 'package:health/health.dart';

// 1. Create Health instance
final health = Health();
await health.configure();

// 2. Request permissions
final types = [HealthDataType.STEPS];
final granted = await health.requestAuthorization(types);

if (granted) {
  // 3. Read today's steps
  final now = DateTime.now();
  final midnight = DateTime(now.year, now.month, now.day);
  final steps = await health.getTotalStepsInInterval(midnight, now);
  
  print('Steps today: ${steps ?? 0}');
}

For a complete working implementation with UI, see the example app.

Next steps

Installation

Add the plugin to your Flutter project.

Quickstart

Configure the plugin, request permissions, and read, write and delete data.

Permissions

Request, check and revoke access to health data.

Data types

See every supported data type, its unit and its platforms.

Quick links

Page · DocumentationCARP DocumentationPage · DocumentationIntroductionPage · DocumentationQuickstartPage · DocumentationTerminologyPage · DocumentationArchitecture