Flutter

Connections

Value
Platform
Description

Connection.appleHealth

iOS

Apple Health (HealthKit)

Connection.samsung

Android

Samsung Health, read via Health Connect (filtered to Samsung Health data)

Connection.healthConnect

Android

Health Connect (reads all data sources)

Connection.googleFit

Android

Google Fit (via Health Connect, filtered to Google Fit data)

CustomPermission

Use these to request a subset of permissions. When not specified, all permissions from your developer scopes are requested. See lib/models/enums.dart for the exact value names. The tables below show what each value requests on each platform; see Permissions mapping for the full reference.

Notable enum gaps specific to the Flutter SDK: menstruation and electrocardiogram are recognized on iOS but silently ignored on Android. mindfulness is recognized on both native platforms but has no Dart enum value.

Each CustomPermissions value maps to one or more HealthKit types. When you don't pass customPermissions, the SDK requests every type associated with the data-type groups in your developer scopes — so the HealthKit prompt can show a long list. Pass customPermissions to request a narrower set.

Activity & workouts

CustomPermissions value

HealthKit type(s) requested

WORKOUT_TYPE

Workouts

ACTIVITY_SUMMARY

Activity summary, Stand time, Exercise time

ACTIVE_DURATIONS

Exercise time

CALORIES

Active energy burned

BASAL_ENERGY_BURNED

Resting (basal) energy burned

STEPS

Steps

FLIGHTS_CLIMBED

Flights climbed

EXERCISE_DISTANCE

Distance (walking/running, cycling, swimming, wheelchair)

SWIMMING_SUMMARY

Swimming stroke count

LOCATION

Workout route

SPEED

Walking speed (iOS 14+), running speed (16+), cycling speed & cadence (17+)

POWER

Running power (iOS 16+), cycling power (17+)

MINDFULNESS

Mindful sessions

Heart & cardiovascular

CustomPermissions value

HealthKit type(s) requested

HEART_RATE

Heart rate

RESTING_HEART_RATE

Resting heart rate

HEART_RATE_VARIABILITY

Heart rate variability (SDNN)

INTERBEAT

Beat-to-beat measurements

ELECTROCARDIOGRAM

Electrocardiograms (iOS 14+)

VO2MAX

VO₂ max

BLOOD_PRESSURE

Blood pressure (systolic & diastolic)

Vitals

CustomPermissions value

HealthKit type(s) requested

RESPIRATORY_RATE

Respiratory rate

OXYGEN_SATURATION

Blood oxygen

BLOOD_GLUCOSE

Blood glucose

BODY_TEMPERATURE

Body temperature (+ wrist temperature on iOS 16+)

Body measurements

CustomPermissions value

HealthKit type(s) requested

HEIGHT

Height

WEIGHT

Body mass

BMI

Body mass index

BODY_FAT

Body fat percentage

LEAN_BODY_MASS

Lean body mass

Sleep

CustomPermissions value

HealthKit type(s) requested

SLEEP_ANALYSIS

Sleep analysis

Nutrition

CustomPermissions value

HealthKit type(s) requested

NUTRITION_CALORIES

Dietary energy consumed

NUTRITION_PROTEIN

Dietary protein

NUTRITION_CARBOHYDRATES

Dietary carbohydrates

NUTRITION_FAT_TOTAL

Dietary total fat

NUTRITION_FIBRE

Dietary fiber

NUTRITION_SUGAR

Dietary sugar

NUTRITION_SODIUM

Dietary sodium

NUTRITION_CHOLESTEROL

Dietary cholesterol

NUTRITION_VITAMIN_C

Dietary vitamin C

NUTRITION_VITAMIN_A

Dietary vitamin A

NUTRITION_WATER

Dietary water

Reproductive health

CustomPermissions value

HealthKit type(s) requested

MENSTRUATION

Menstrual flow

Profile

CustomPermissions value

HealthKit type(s) requested

GENDER

Biological sex

DATE_OF_BIRTH

Date of birth

Symptoms

CustomPermissions value

HealthKit type(s) requested

SYMPTOM_COUGHING

Coughing (iOS 13.6+)

SYMPTOM_FEVER

Fever (iOS 13.6+)

SYMPTOM_SORE_THROAT

Sore throat (iOS 13.6+)

Requesting a data-type group (rather than customPermissions) requests a broad superset of types. For example, the Body group requests heart rate, HRV, VO₂ max, glucose, blood pressure, body temperature, ECG and more — not just body-composition metrics. Use customPermissions when you want the HealthKit prompt to show only specific toggles.

Types

SuccessMessage

DataMessage

When toWebhook is true, the data field contains { "reference": "..." } — a reference ID for the webhook payload. When false, data contains the full normalized health data map.

UserId

Initialization

initTerra

Creates and authenticates a Terra SDK instance. This makes a network call to Terra's servers to validate your developer ID and reconnect existing users.

  • String devID ➡ Your developer ID from the Terra Dashboard.

  • String referenceID ➡ An identifier for your app's user. This value appears as reference_id in webhook payloads and API responses, allowing you to map Terra users back to your own user system.

returns Future<SuccessMessage?>

Connection setup/management

initConnection

Authenticates a new user connection with Terra's servers and triggers the platform permission dialog (HealthKit on iOS, Health Connect on Android). This makes a network call.

This function should only be called once per user/connection type. On subsequent app launches, initTerra will automatically reconnect existing users.

  • Connection connection ➡ The connection type (e.g. Connection.appleHealth, Connection.samsung). Must match the platform.

  • String token ➡ A single-use authentication token from the Generate Authentication Token endpoint.

  • bool schedulerOn ➡ Enables automatic data delivery. On iOS, enables HealthKit background delivery (also requires setUpBackgroundDelivery in AppDelegate). On Android, enables periodic WorkManager-based data fetches.

  • List<CustomPermission> customPermissions ➡ Request specific permissions. Empty list defaults to all scopes.

returns Future<SuccessMessage?> — check error field for specific failure reasons.

getUserId

Returns the Terra user ID for a connection, or null if no connection exists. This is a local read with no network call.

  • Connection connection ➡ The connection to get the user ID for.

returns Future<UserId?>userId is null if no connection exists.

Data retrieval

All data retrieval functions make network calls — even with toWebhook = false, the SDK sends data to Terra's normalization servers and returns the normalized result.

toWebhook behavior:

Both paths require network connectivity.

toWebhook

What happens

DataMessage.data contains

true (default)

Data is fetched and sent to your webhook

{ "reference": "..." } — a reference ID only

false

Data is fetched, normalized, and returned locally

The full normalized health data map

getActivity

Retrieves workout and exercise session data.

getDaily

Retrieves daily summary data (steps, calories, distance, heart rate, etc.).

getBody

Retrieves body measurement data (weight, height, BMI, heart rate, blood pressure, etc.).

Unlike iOS and React Native, the Flutter SDK does not have a latestReading parameter on getBody.

getSleep

Retrieves sleep session data (stages, duration, heart rate during sleep, etc.).

getNutrition

Retrieves nutrition and meal data.

getMenstruation

Retrieves menstrual cycle data. iOS only — throws MissingPluginException on Android.

getAthlete

Retrieves the user's athlete profile (biographical data, no date range needed). iOS only — throws MissingPluginException on Android.

Common parameters for all data getters:

  • Connection connection ➡ The connection to get data from.

  • DateTime startDate ➡ Start of the date range. Converted to UTC before sending to native.

  • DateTime endDate ➡ End of the date range. Converted to UTC before sending to native.

  • (Optional) bool toWebhook ➡ Whether to send data to your webhook. Defaults to true.

Android-only methods

These functions are only available on Android. They will throw MissingPluginException on iOS.

isHealthConnectAvailable

Checks if Health Connect is available on the device. Local check, no network call.

getGivenPermissions

Returns the Health Connect permissions currently granted to your app. Returns permission name strings like "READ_HEART_RATE", "READ_STEPS", etc.

iOS-only methods

setIgnoredSources

Filters out health data from specific apps when reading from Apple Health. Use this to prevent double-counting when a user connects a data source both through Terra's API (e.g. WHOOP, Garmin) and has that same app syncing into Apple Health.

  • List<String> sources ➡ App bundle identifiers to exclude (e.g. ["com.whoop.app", "com.garmin.connect.mobile"]).

  • Takes effect on the next data fetch (including background delivery).

  • Not persisted across app launches — call this on every app start if needed.

  • Android: this function is a no-op. It is accepted but does nothing.

Last updated

Was this helpful?