cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
554 stars 681 forks source link

[health] writeHealthData() saves incorrect weight to Health Connect #997

Closed rafaellop closed 4 months ago

rafaellop commented 4 months ago

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

Describe the bug

The writeHealthData() function saves incorrect weight to Health Connect. I have Health Connect app set up to use POUNDS and in my app I also use POUNDS internally. If I save a weight value to the Health Connect app the Health Connect record shows wrong weight.

To Reproduce

The code below is supposed to save 100 pounds to the Health Connect():

await health.writeHealthData(value: 100.00, type: HealthDataType.WEIGHT, startTime: date, endTime: date);

In Health Connect app the record for this write says 220.5 lbs. There's a conversion somewhere.

Expected behavior

Save the data without any conversion.

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22000.2538])
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 3.2)
[√] VS Code (version 1.91.1)
[√] Connected device (4 available)
[√] Network resources