Skip to content

[health 13.1.1] Apple Watch device information (deviceModel) missing again in 13.1.1 #1

@a-oda-wb

Description

@a-oda-wb

Plugin Name

health

Plugin Version

13.1.1

Device

iPhone 16 Pro

Operating System

iOS 18.7

Describe the bug

Hi,

Since updating from the health plugin version 12.2.x to 13.x.x, the deviceModel field has started returning "null" on iOS.
As a result, it’s no longer possible to determine whether a HealthKit sample came from an Apple Watch or an iPhone, which worked correctly in previous versions.

I confirmed that this problem was originally fixed in the following PR:
👉 carp-dk/flutter-plugins#1176

However, after the major Swift refactor introduced around version 13.0.0, the logic for reading sample.device?.model seems to have been removed (or never re-added).
The current implementation in HealthDataReader.swift does not include any mapping of HKSample.device to JSON output.

🔍Example responses

  • v12.2.x response
HealthDataPoint -
    uuid: xxx-xxxx-xxxx-xxxx,
    value: NumericHealthValue - numericValue: 171.0,
    unit: COUNT,
    dateFrom: 2025-09-24 10:10:00,
    dateTo: 2025-09-24 10:20:00,
    dataType: STEPS,
    platform: HealthPlatformType.appleHealth,
    deviceId: unknown,
    sourceId: com.apple.health.xxx-xxxx-xxxx-xxxx,
    sourceName: Apple Watch,
    recordingMethod: RecordingMethod.automatic
    workoutSummary: null
    metadata: {}
    deviceModel: Watch, 
HealthDataPoint -
    uuid: xxx-xxxx-xxxx-xxxx,
    value: NumericHealthValue - numericValue: 54.0,
    unit: COUNT,
    dateFrom: 2025-09-24 10:20:00,
    dateTo: 2025-09-24 10:30:00,
    dataType: STEPS,
    platform: HealthPlatformType.appleHealth,
    deviceId: unknown,
    sourceId: com.apple.health.xxx-xxxx-xxxx-xxxx,
    sourceName: iPhone16Pro
    recordingMethod: RecordingMethod.automatic
    workoutSummary: null
    metadata: {}
    deviceModel: iPhone,
  • v13.x.x response
HealthDataPoint -
    uuid: xxx-xxxx-xxxx-xxxx,
    value: NumericHealthValue - numericValue: 171.0,
    unit: COUNT,
    dateFrom: 2025-09-24 10:10:00,
    dateTo: 2025-09-24 10:20:00,
    dataType: STEPS,
    platform: HealthPlatformType.appleHealth,
    deviceId: unknown,
    sourceId: com.apple.health.xxx-xxxx-xxxx-xxxx,
    sourceName: Apple Watch
    recordingMethod: RecordingMethod.automatic
    workoutSummary: null
    metadata: {}
    deviceModel: null,     // regression from v12.2.x where deviceModel was populated
HealthDataPoint -
    uuid: xxx-xxxx-xxxx-xxxx,
    value: NumericHealthValue - numericValue: 54.0,
    unit: COUNT,
    dateFrom: 2025-09-24 10:20:00,
    dateTo: 2025-09-24 10:30:00,
    dataType: STEPS,
    platform: HealthPlatformType.appleHealth,
    deviceId: unknown,
    sourceId: com.apple.health.xxx-xxxx-xxxx-xxxx,
    sourceName: iPhone16Pro
    recordingMethod: RecordingMethod.automatic
    workoutSummary: null
    metadata: {}
    deviceModel: null,    // regression from v12.2.x where deviceModel was populated

Steps to Reproduce

  1. Use the health Flutter plugin version 12.2.x and retrieve HealthKit data on iOS — confirm deviceModel is populated (e.g. "Apple Watch", "iPhone").
  2. Upgrade the health plugin to version 13.x.x.
  3. Retrieve the same HealthKit data on the same iOS device.
  4. Observe that the deviceModel field now returns null, even for Apple Watch data.

Expected Behavior

The deviceModel field should correctly return the originating device model name for each HealthKit sample, as it did in v12.2.x.

Example:

  • For Apple Watch data: "Watch" or "Apple Watch Series X"
  • For iPhone data: "iPhone"

This allows developers to distinguish between data from an Apple Watch and data from an iPhone.

Actual Behavior

After upgrading to the health plugin version 13.x.x, the deviceModel field returns null for all HealthKit samples on iOS.

Example:

  • v13.x.x response:

deviceModel: null, // regression from v12.2.x where deviceModel was populated

This behavior breaks the ability to distinguish between data coming from an Apple Watch and data coming from an iPhone, which worked correctly in version 12.2.x.

Flutter Logs

Screenshots

No response

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.32.8, on macOS 15.5 24F74 darwin-arm64, locale ja-JP)
    • Flutter version 3.32.8 at /Users/USER_NAME/flutter/fvm/versions/3.32.8
    • Framework revision edada7c56e (3 months ago), 2025-07-25 14:08:03 +0000
    • Engine revision ef0cd00091
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/USER_NAME/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin and Dart plugin installed
    • Java version OpenJDK Runtime Environment (build 17.0.9+0)

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin and Dart plugin installed
    • Java version OpenJDK Runtime Environment (build 21.0.3+)

[✓] VS Code (version 1.104.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.120.0
   
[✓] Connected device (5 available)    
    • Android emulator (mobile) • android-arm64  • Android 15 (API 35) (emulator)
    • iOS device 1 (mobile)     • ios            • iOS 18.0.1
    • iOS simulator (mobile)    • ios            • iOS 18.2
    • macOS (desktop)           • macos
    • Chrome (web)              • web-javascript

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions