# Apple health medication sync

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

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

## AppleHealthMedicationSyncCompleted [#applehealthmedicationsynccompleted]

```dart
final class AppleHealthMedicationSyncCompleted extends AppleHealthMedicationSyncResult
```

The medication list and the available dose events were processed.

### Constructors [#constructors]

#### AppleHealthMedicationSyncCompleted.new [#applehealthmedicationsynccompletednew]

```dart
AppleHealthMedicationSyncCompleted({required int medications, required int doseEvents})
```

Creates a completed result.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `medications` | `int` | required named |  |
| `doseEvents` | `int` | required named |  |

### Properties [#properties]

#### AppleHealthMedicationSyncCompleted.medications [#applehealthmedicationsynccompletedmedications]

```dart
final int medications
```

Medications HealthKit returned.

#### AppleHealthMedicationSyncCompleted.doseEvents [#applehealthmedicationsynccompleteddoseevents]

```dart
final int doseEvents
```

Dose events imported, retracted or deleted.


## AppleHealthMedicationSyncResult [#applehealthmedicationsyncresult]

```dart
sealed class AppleHealthMedicationSyncResult
```

What [`syncAppleHealthMedications`](#syncapplehealthmedications) did.

### Constructors [#constructors-1]

#### AppleHealthMedicationSyncResult.new [#applehealthmedicationsyncresultnew]

```dart
AppleHealthMedicationSyncResult()
```


## AppleHealthMedicationSyncUnsupported [#applehealthmedicationsyncunsupported]

```dart
final class AppleHealthMedicationSyncUnsupported extends AppleHealthMedicationSyncResult
```

This device cannot import medications; nothing was read or deleted.

### Constructors [#constructors-2]

#### AppleHealthMedicationSyncUnsupported.new [#applehealthmedicationsyncunsupportednew]

```dart
AppleHealthMedicationSyncUnsupported(AppleHealthMedicationUnsupportedReason reason)
```

Creates an unsupported result.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `reason` | `AppleHealthMedicationUnsupportedReason` | positional |  |

### Properties [#properties-1]

#### AppleHealthMedicationSyncUnsupported.reason [#applehealthmedicationsyncunsupportedreason]

```dart
final AppleHealthMedicationUnsupportedReason reason
```

Why the import cannot run.


## syncAppleHealthMedications [#syncapplehealthmedications]

```dart
Future<AppleHealthMedicationSyncResult> syncAppleHealthMedications({required Ovok client, required String patientId, required AppleHealthMedicationSource source})
```

Imports the signed-in patient's Apple Health medications and logged doses.

Mirrors `syncAppleHealthMedications` of `@ovok/native/next`. Throws
[`OvokConfigException`](/flutter-sdk/reference/ovok_sdk/ovok-exception#ovokconfigexception) when `patientId` is not the signed-in patient. Reads
medications through `source`; a denied read or an unsupported device never
deletes imported data.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `client` | `Ovok` | required named |  |
| `patientId` | `String` | required named |  |
| `source` | `AppleHealthMedicationSource` | required named |  |
