flutter-plugins
flutter-plugins copied to clipboard
[health 3.0.5] An extra value comes to SLEEP_ASLEEP from Apple Health kit
Remember to specify the plugin name in the title! health 3.0.5
Device and OS
- Device: [iPhone 7]
- OS: [iOS 14.4.2]
Describe the bug
In the "Apple Health kit" app, my indicator of sleep is 6 hours and 15 minutes (375 minutes awake) on 04/07/21(screenshot 1 and 3)
Today (04/07/21) received data on sleep via your "health" library for Flutter. However, more data on sleep came (screenshot 2)
{"value": 374.98333333333335, "unit": "HealthDataUnit.MINUTES", "dateFrom": "2021-04-07 03: 40: 00.000", "dateTo": "2021-04-07 09: 54: 59.000" , "dataType": "HealthDataType.SLEEP_ASLEEP", "platform": "PlatformType.IOS"},
{"value": 433.98333333333335, "unit": "HealthDataUnit.MINUTES", "dateFrom": "2021-04-07 03 : 39: 00.000 "," dateTo ":" 2021-04-07 10: 52: 59.000 "," dataType ":" HealthDataType.SLEEP_ASLEEP "," platform ":" PlatformType.IOS "}
In the data of the past days, I also noticed the presence of one extra value (usually it is the largest one).
Actual behavior
The main problem is that when adding the SLEEP_ASLEEP data, I get the total asleep value more than expected.
Expected behavior
After adding all the data of the SLEEP_ASLEEP type, I get the correct total value in minutes as in the "Apple Health kit" application
Screenshots
I am facing same issue with steps data [IOS], getting value more than expected.
@ViktorQA97 Are you able to resolve this issue? if yes, please help me how to resolve this issue.
I ran into this too
This is probably b/c IOS records sleep from all apps, and often times the samples overlap in time
so you'll have to filter out by a certain source, OR decide by time (if the sources overlap)


