One domain model, both stores
A WeightRecord carries a Mass on Android and on iOS. Write the feature once instead of maintaining two parallel health layers.
Learn the data model
Read, write, aggregate, and sync health data across Android Health Connect and Apple HealthKit — with one shared domain model, compile-time safety, and a zero-logging default.
Your mobile app sends requests to the Health Connector SDK. The SDK routes each request separately to Android Health Connect and Apple HealthKit.
Install the package, declare what your app needs on the platform you target, then call one connector.
flutter pub add health_connectorDeclare each data type you touch in android/app/src/main/AndroidManifest.xml, and make MainActivity extend FlutterFragmentActivity:
<uses-permission android:name="android.permission.health.READ_STEPS" />
<uses-permission android:name="android.permission.health.WRITE_STEPS" />The Dart is identical on both platforms:
final connector = await HealthConnector.create();
await connector.requestPermissions([HealthDataType.steps.readPermission]);
final response = await connector.readRecords(
HealthDataType.steps.readInTimeRange(
startTime: DateTime.now().subtract(const Duration(days: 7)),
endTime: DateTime.now(),
),
);
// Statically inferred as List<StepsRecord> — no cast required.
for (final record in response.records) {
print('${record.count.value} steps at ${record.startTime}');
}In production
See how teams use the SDK in real products.
Created by Felipe Valtl de MelloPrincipal Software Engineer at Transfeera
Try it on your device
Test permissions, health records, aggregations, and synchronization on a real device without first creating a Flutter project.