[Health: 9.0.1] Total number in interval
It would be great to have a getTotalInInterval method for each data type. Currently, only steps have a method for obtaining a total number within a specified interval - getTotalStepsInInterval. Other data types can only be read using getHealthDataFromTypes, which returns a list of small periods of data collected from different sources. When I attempt to concatenate these intervals, I obtain a different number than what the native Google Fit or Apple Health apps. This discrepancy is primarily due to overlapping intervals from different tracking sources.
I noticed the same problem. There are native Android and iOS methods to get the total number for a period, so we can use them in a Flutter app in the same way as getTotalStepsInInterval. I have created a new pull request with the new methods getTotalCaloriesInInterval and getTotalDistanceInInterval added. You can either wait for it to be merged or use it right away as a git dependency in your pubspec:
dependencies:
flutter:
sdk: flutter
health:
git:
url: https://github.com/YatsenkoDev/flutter-plugins.git
path: packages/health
it gives null