fetchHealthDataForRange

actual suspend fun fetchHealthDataForRange(startDate: LocalDate, endDate: LocalDate): List<HealthData>

Fetches health data for a range of dates in a single batch operation.

More efficient than calling fetchHealthDataByDate in a loop, as it uses fewer underlying queries by leveraging platform-specific batch APIs (e.g. a single HKStatisticsCollectionQuery per metric on iOS/watchOS).

Return

A list of HealthData objects, one per day in the range.

Parameters

startDate

The first date (inclusive) of the range.

endDate

The last date (inclusive) of the range.

Throws

if an error occurs while fetching the data.

actual suspend fun fetchHealthDataForRange(startDate: LocalDate, endDate: LocalDate): List<HealthData>

Fetches health data for a range of dates in a single batch operation.

More efficient than calling fetchHealthDataByDate in a loop, as it uses fewer underlying queries by leveraging platform-specific batch APIs (e.g. a single HKStatisticsCollectionQuery per metric on iOS/watchOS).

Return

A list of HealthData objects, one per day in the range.

Parameters

startDate

The first date (inclusive) of the range.

endDate

The last date (inclusive) of the range.

Throws

if an error occurs while fetching the data.

actual suspend fun fetchHealthDataForRange(startDate: LocalDate, endDate: LocalDate): List<HealthData>

Fetches health data for a range of dates in a single batch operation.

More efficient than calling fetchHealthDataByDate in a loop, as it uses fewer underlying queries by leveraging platform-specific batch APIs (e.g. a single HKStatisticsCollectionQuery per metric on iOS/watchOS).

Return

A list of HealthData objects, one per day in the range.

Parameters

startDate

The first date (inclusive) of the range.

endDate

The last date (inclusive) of the range.

Throws

if an error occurs while fetching the data.