getHealthDataFromTypes method
Future<List<HealthDataPoint> >
getHealthDataFromTypes({
- required List<
HealthDataType> types, - required DateTime startTime,
- required DateTime endTime,
- bool includeManualEntry = true,
Fetch a list of health data points based on types
.
Implementation
Future<List<HealthDataPoint>> getHealthDataFromTypes({
required List<HealthDataType> types,
required DateTime startTime,
required DateTime endTime,
bool includeManualEntry = true,
}) async {
List<HealthDataPoint> dataPoints = [];
for (var type in types) {
final result =
await _prepareQuery(startTime, endTime, type, includeManualEntry);
dataPoints.addAll(result);
}
const int threshold = 100;
if (dataPoints.length > threshold) {
return compute(removeDuplicates, dataPoints);
}
return removeDuplicates(dataPoints);
}