# Apple health medication source

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

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

## AppleHealthDoseEvent [#applehealthdoseevent]

```dart
class AppleHealthDoseEvent
```

One logged dose from HealthKit.

### Constructors [#constructors]

#### AppleHealthDoseEvent.new [#applehealthdoseeventnew]

```dart
AppleHealthDoseEvent({
  required String uuid,
  required String medicationIdentifier,
  required String medicationDisplayText,
  required DateTime startDate,
  required AppleHealthDoseStatus status,
  num? doseQuantity,
  String? unit,
})
```

Creates a dose event read from HealthKit.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `uuid` | `String` | required named |  |
| `medicationIdentifier` | `String` | required named |  |
| `medicationDisplayText` | `String` | required named |  |
| `startDate` | `DateTime` | required named |  |
| `status` | `AppleHealthDoseStatus` | required named |  |
| `doseQuantity` | `num?` | named |  |
| `unit` | `String?` | named |  |

### Properties [#properties]

#### AppleHealthDoseEvent.uuid [#applehealthdoseeventuuid]

```dart
final String uuid
```

The HealthKit sample UUID; the source identity.

#### AppleHealthDoseEvent.medicationIdentifier [#applehealthdoseeventmedicationidentifier]

```dart
final String medicationIdentifier
```

The concept identifier of the medication taken.

#### AppleHealthDoseEvent.medicationDisplayText [#applehealthdoseeventmedicationdisplaytext]

```dart
final String medicationDisplayText
```

The medication name HealthKit shows.

#### AppleHealthDoseEvent.startDate [#applehealthdoseeventstartdate]

```dart
final DateTime startDate
```

When the dose happened.

#### AppleHealthDoseEvent.status [#applehealthdoseeventstatus]

```dart
final AppleHealthDoseStatus status
```

How the dose was logged.

#### AppleHealthDoseEvent.doseQuantity [#applehealthdoseeventdosequantity]

```dart
final num? doseQuantity
```

The amount taken, when HealthKit has one.

#### AppleHealthDoseEvent.unit [#applehealthdoseeventunit]

```dart
final String? unit
```

The unit of [`doseQuantity`](#applehealthdoseeventdosequantity).


## AppleHealthDoseEventBatch [#applehealthdoseeventbatch]

```dart
class AppleHealthDoseEventBatch
```

Dose events changed since an anchor.

### Constructors [#constructors-1]

#### AppleHealthDoseEventBatch.new [#applehealthdoseeventbatchnew]

```dart
AppleHealthDoseEventBatch({
  required List<AppleHealthDoseEvent> events,
  required List<String> deletedEventUuids,
  String? nextAnchor,
})
```

Creates a batch; [`nextAnchor`](#applehealthdoseeventbatchnextanchor) is the cursor to read from next time.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `events` | `List<AppleHealthDoseEvent>` | required named |  |
| `deletedEventUuids` | `List<String>` | required named |  |
| `nextAnchor` | `String?` | named |  |

### Properties [#properties-1]

#### AppleHealthDoseEventBatch.events [#applehealthdoseeventbatchevents]

```dart
final List<AppleHealthDoseEvent> events
```

New or changed dose events.

#### AppleHealthDoseEventBatch.deletedEventUuids [#applehealthdoseeventbatchdeletedeventuuids]

```dart
final List<String> deletedEventUuids
```

UUIDs HealthKit reports as deleted.

#### AppleHealthDoseEventBatch.nextAnchor [#applehealthdoseeventbatchnextanchor]

```dart
final String? nextAnchor
```

An opaque cursor for the next read.


## AppleHealthDoseStatus [#applehealthdosestatus]

```dart
enum AppleHealthDoseStatus
```

How HealthKit logged a medication dose.

### Values [#values]

#### AppleHealthDoseStatus.taken [#applehealthdosestatustaken]

```dart
static const AppleHealthDoseStatus taken
```

The person took the dose.

#### AppleHealthDoseStatus.skipped [#applehealthdosestatusskipped]

```dart
static const AppleHealthDoseStatus skipped
```

The person skipped the dose.

#### AppleHealthDoseStatus.notLogged [#applehealthdosestatusnotlogged]

```dart
static const AppleHealthDoseStatus notLogged
```

An earlier log was cleared; the imported event is retracted.

#### AppleHealthDoseStatus.other [#applehealthdosestatusother]

```dart
static const AppleHealthDoseStatus other
```

A reminder state with no log; ignored.


## AppleHealthMedication [#applehealthmedication]

```dart
class AppleHealthMedication
```

One medication in the person's Apple Health list.

### Constructors [#constructors-2]

#### AppleHealthMedication.new [#applehealthmedicationnew]

```dart
AppleHealthMedication({
  required String identifier,
  required String displayText,
  String? nickname,
  bool isArchived = false,
  List<Map<String, dynamic>> relatedCodings = const [],
})
```

Creates a medication read from HealthKit.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `identifier` | `String` | required named |  |
| `displayText` | `String` | required named |  |
| `nickname` | `String?` | named |  |
| `isArchived` | `bool` | named | `false` |
| `relatedCodings` | `List<Map<String, dynamic>>` | named | `const []` |

### Properties [#properties-2]

#### AppleHealthMedication.identifier [#applehealthmedicationidentifier]

```dart
final String identifier
```

The HealthKit medication concept identifier; the source identity.

#### AppleHealthMedication.displayText [#applehealthmedicationdisplaytext]

```dart
final String displayText
```

The name HealthKit shows.

#### AppleHealthMedication.nickname [#applehealthmedicationnickname]

```dart
final String? nickname
```

The name the person gave it.

#### AppleHealthMedication.isArchived [#applehealthmedicationisarchived]

```dart
final bool isArchived
```

Whether the person archived the medication.

#### AppleHealthMedication.relatedCodings [#applehealthmedicationrelatedcodings]

```dart
final List<Map<String, dynamic>> relatedCodings
```

Codings such as RxNorm that HealthKit relates to the concept.


## AppleHealthMedicationSource [#applehealthmedicationsource]

```dart
abstract interface class AppleHealthMedicationSource
```

Reads medications from HealthKit.

The iOS 26 bridge that implements this is not in the SDK yet; the `health` plugin has no medication API.

### Methods [#methods]

#### AppleHealthMedicationSource.unsupportedReason [#applehealthmedicationsourceunsupportedreason]

```dart
Future<AppleHealthMedicationUnsupportedReason?> unsupportedReason()
```

Null when medications can be read here.

Returns `Future<AppleHealthMedicationUnsupportedReason?>`.

#### AppleHealthMedicationSource.requestAuthorization [#applehealthmedicationsourcerequestauthorization]

```dart
Future<void> requestAuthorization()
```

Asks the person to share their medications.

Returns `Future<void>`.

#### AppleHealthMedicationSource.medications [#applehealthmedicationsourcemedications]

```dart
Future<List<AppleHealthMedication>> medications()
```

Reads the person's medication list.

Returns `Future<List<AppleHealthMedication>>`.

#### AppleHealthMedicationSource.doseEvents [#applehealthmedicationsourcedoseevents]

```dart
Future<AppleHealthDoseEventBatch> doseEvents({String? anchor})
```

Reads dose events changed since `anchor`; null reads them all.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `anchor` | `String?` | named |  |

Returns `Future<AppleHealthDoseEventBatch>`.


## AppleHealthMedicationUnsupportedReason [#applehealthmedicationunsupportedreason]

```dart
enum AppleHealthMedicationUnsupportedReason
```

Why an Apple Health medication import cannot run on this device.

### Values [#values-1]

#### AppleHealthMedicationUnsupportedReason.iosOnly [#applehealthmedicationunsupportedreasoniosonly]

```dart
static const AppleHealthMedicationUnsupportedReason iosOnly
```

The device is not running iOS.

#### AppleHealthMedicationUnsupportedReason.requiresIos26 [#applehealthmedicationunsupportedreasonrequiresios26]

```dart
static const AppleHealthMedicationUnsupportedReason requiresIos26
```

HealthKit medications need iOS 26 or later.
