cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
550 stars 675 forks source link

[health: ^4.4.0] Writing MINDFULNESS data crashes! #660

Open devShakib015 opened 1 year ago

devShakib015 commented 1 year ago

Describe the bug

When I try to write MINDFULNESS data using "health.writeHealthData", the app crashes and it lost the connection to device.

It's gives an error message:

Could not cast value of type 'HKCategoryType' (0x1b91dcfc0) to 'HKQuantityType' (0x1b91dcf98).

Screenshots

This is my code! I have tried various ways to do it. But it happens every time.

Screenshot 2023-01-23 at 16 28 16

cancng commented 1 year ago

same issue, app is crashing

kociubin commented 1 year ago

Same issue for me. App crashes when writing MINDFULNESS data. Other data types seem ok (e.g. SLEEP_IN_BED, STEPS).

Please help!

kociubin commented 1 year ago

Same issue for me. App crashes when writing MINDFULNESS data. Other data types seem ok (e.g. SLEEP_IN_BED, STEPS).

Please help!

Nevermind... Setting the data value to 0 resolves the crash.

bool success = await health.writeHealthData(
  0,  //must be 0 for MINDFULNESS
  HealthDataType.MINDFULNESS,
  now.subtract(Duration(minutes: 10)),
  now,
);
Sebo-the-tramp commented 3 weeks ago

It does work for me! thanks. Worth closing the issue!