# Health sync configuration

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_flutter/health-sync-configuration

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## HealthSyncConfiguration [#healthsyncconfiguration]

```dart
class HealthSyncConfiguration<TType>
```

Immutable configuration shared by Apple Health and Health Connect sync.

### Constructors [#constructors]

#### HealthSyncConfiguration.new [#healthsyncconfigurationnew]

```dart
HealthSyncConfiguration<TType>({
  required Map<HealthSyncKey, HealthSyncTypeConfiguration<TType>> dataToSync,
  int chunkSize = defaultHealthSyncChunkSize,
  bool wifiOnly = false,
  void Function(Object?)? onError,
  void Function(Map<HealthSyncKey, SyncProgress>)? onProgress,
})
```

Creates a health sync configuration.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `dataToSync` | `Map<String, HealthSyncTypeConfiguration<TType>>` | required named |  |
| `chunkSize` | `int` | named | `defaultHealthSyncChunkSize` |
| `wifiOnly` | `bool` | named | `false` |
| `onError` | `void Function(Object?)?` | named |  |
| `onProgress` | `void Function(Map<String, SyncProgress>)?` | named |  |

### Properties [#properties]

#### HealthSyncConfiguration.dataToSync [#healthsyncconfigurationdatatosync]

```dart
final Map<String, HealthSyncTypeConfiguration<TType>> dataToSync
```

Data types and source identifiers to import.

#### HealthSyncConfiguration.chunkSize [#healthsyncconfigurationchunksize]

```dart
final int chunkSize
```

Maximum number of records in one provider read.

#### HealthSyncConfiguration.wifiOnly [#healthsyncconfigurationwifionly]

```dart
final bool wifiOnly
```

Whether reads wait for Wi-Fi instead of using cellular data.

#### HealthSyncConfiguration.onError [#healthsyncconfigurationonerror]

```dart
final void Function(Object?)? onError
```

Receives a provider or save failure.

#### HealthSyncConfiguration.onProgress [#healthsyncconfigurationonprogress]

```dart
final void Function(Map<String, SyncProgress>)? onProgress
```

Receives progress snapshots keyed by health sync key.


## HealthSyncTypeConfiguration [#healthsynctypeconfiguration]

```dart
class HealthSyncTypeConfiguration<TType>
```

Sync settings for one health key.

### Constructors [#constructors-1]

#### HealthSyncTypeConfiguration.new [#healthsynctypeconfigurationnew]

```dart
HealthSyncTypeConfiguration<TType>({
  required Iterable<HealthSyncTypeIdentifier<TType>> typeIdentifiers,
  DateTime? minDate,
  HealthDataMode? mode,
})
```

Creates an immutable mapping for one health key.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `typeIdentifiers` | `Iterable<HealthSyncTypeIdentifier<TType>>` | required named |  |
| `minDate` | `DateTime?` | named |  |
| `mode` | `HealthDataMode?` | named |  |

### Properties [#properties-1]

#### HealthSyncTypeConfiguration.typeIdentifiers [#healthsynctypeconfigurationtypeidentifiers]

```dart
final List<HealthSyncTypeIdentifier<TType>> typeIdentifiers
```

Health-source identifiers included for this key.

#### HealthSyncTypeConfiguration.minDate [#healthsynctypeconfigurationmindate]

```dart
final DateTime? minDate
```

Earliest record date to read.

#### HealthSyncTypeConfiguration.mode [#healthsynctypeconfigurationmode]

```dart
final HealthDataMode? mode
```

Overrides the default aggregation mode for this key.


## HealthSyncTypeIdentifier [#healthsynctypeidentifier]

```dart
class HealthSyncTypeIdentifier<TType>
```

A platform type identifier and its optional Ovok observation coding.

### Constructors [#constructors-2]

#### HealthSyncTypeIdentifier.new [#healthsynctypeidentifiernew]

```dart
HealthSyncTypeIdentifier<TType>({
  required TType typeIdentifier,
  String? code,
  String? system,
  String? display,
})
```

Creates a health-source identifier with optional observation coding.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `typeIdentifier` | `TType` | required named |  |
| `code` | `String?` | named |  |
| `system` | `String?` | named |  |
| `display` | `String?` | named |  |

### Properties [#properties-2]

#### HealthSyncTypeIdentifier.typeIdentifier [#healthsynctypeidentifiertypeidentifier]

```dart
final TType typeIdentifier
```

Identifier understood by the configured health source.

#### HealthSyncTypeIdentifier.code [#healthsynctypeidentifiercode]

```dart
final String? code
```

Observation code; defaults to the SDK's reviewed mapping.

#### HealthSyncTypeIdentifier.system [#healthsynctypeidentifiersystem]

```dart
final String? system
```

Coding system for [`code`](#healthsynctypeidentifiercode).

#### HealthSyncTypeIdentifier.display [#healthsynctypeidentifierdisplay]

```dart
final String? display
```

Human-readable display for [`code`](#healthsynctypeidentifiercode).


## defaultHealthSyncChunkSize [#defaulthealthsyncchunksize]

```dart
int get defaultHealthSyncChunkSize
```
