HealthConnector class abstract interface

Main entry point for interacting with platform-specific health APIs.

Provides a unified interface for accessing health and fitness data across multiple health platforms.

Supported Health Platforms

  • iOS HealthKit: Uses Apple HealthKit Framework
  • Android Health Connect: Uses Google Health Connect SDK

Core Capabilities

  • Permission Management: Request, check, and revoke health data access
  • Data Reading: Query individual records or time ranges with pagination
  • Data Writing: Store single or multiple health records atomically
  • Aggregations: Compute sums, averages, min/max over time ranges
  • Record Updates: Modify existing records (Android Health Connect Only)
  • Data Deletion: Remove records by ID or time range

See Also

Annotations

Properties

config HealthConnectorConfig
The configuration used by this connector.
no setter
hashCode int
The hash code for this object.
no setterinherited
healthPlatform HealthPlatform
The health platform being used by this connector.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

aggregate<U extends MeasurementUnit>(AggregateRequest<U> request) Future<U>
Computes an aggregated value (sum, average, minimum, or maximum) over all records of a specific type within the specified time range.
deleteRecords(DeleteRecordsRequest request) Future<void>
Deletes health records based on the provided request.
getFeatureStatus(HealthPlatformFeature feature) Future<HealthPlatformFeatureStatus>
Checks the availability status of a specific platform feature.
getGrantedPermissions() Future<List<Permission>>
Gets all permissions that have been granted to the app.
getPermissionStatus(Permission permission) Future<PermissionStatus>
Gets the current permission status for a specific permission.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readExerciseRoute(HealthRecordId exerciseSessionId) Future<ExerciseRoute?>
Reads the exercise route for a given exercise session.
readRecord<R extends HealthRecord>(ReadRecordByIdRequest<R> request) Future<R?>
Reads a single health record by ID.
readRecords<R extends HealthRecord>(ReadRecordsInTimeRangeRequest<R> request) Future<ReadRecordsInTimeRangeResponse<R>>
Queries health records of a specific type within the specified time range. Results are paginated to handle large datasets efficiently.
requestPermissions(List<Permission> permissions) Future<List<PermissionRequestResult>>
Requests the specified permissions from the health platform.
revokeAllPermissions() Future<void>
Revokes all permissions that have been granted to the app.
synchronize({required List<HealthDataType<HealthRecord, MeasurementUnit>> dataTypes, required HealthDataSyncToken? syncToken}) Future<HealthDataSyncResult>
Synchronizes health data using incremental change tracking.
toString() String
A string representation of this object.
inherited
updateRecord<R extends HealthRecord>(R record) Future<void>
Updates an existing health record.
updateRecords<R extends HealthRecord>(List<R> records) Future<void>
Updates multiple existing health records in a single batch operation.
writeRecord<R extends HealthRecord>(R record) Future<HealthRecordId>
Writes a single health record to the platform.
writeRecords<R extends HealthRecord>(List<R> records) Future<List<HealthRecordId>>
Writes multiple health records atomically.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create([HealthConnectorConfig config = const HealthConnectorConfig()]) Future<HealthConnector>
Creates a new HealthConnector instance.
getHealthPlatformStatus() Future<HealthPlatformStatus>
Checks the availability status of the health platform.
launchHealthAppPageInAppStore() Future<void>
Launches the health app page in the platform's app store.