Skip to content

Commit

Permalink
Merge pull request #945 from cph-cachet/bardram/health-update
Browse files Browse the repository at this point in the history
Update main.dart
  • Loading branch information
bardram authored Apr 3, 2024
2 parents 942d1e4 + b0947d1 commit 1a09f17
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions packages/health/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,23 @@ class _HealthAppState extends State<HealthApp> {
// Clear old data points
_healthDataList.clear();

// try {
// fetch health data
List<HealthDataPoint> healthData = await Health().getHealthDataFromTypes(
types: types,
startTime: yesterday,
endTime: now,
);
try {
// fetch health data
List<HealthDataPoint> healthData = await Health().getHealthDataFromTypes(
types: types,
startTime: yesterday,
endTime: now,
);

debugPrint('Total number of data points: ${healthData.length}. '
'${healthData.length > 100 ? 'Only showing the first 100.' : ''}');
debugPrint('Total number of data points: ${healthData.length}. '
'${healthData.length > 100 ? 'Only showing the first 100.' : ''}');

// save all the new data points (only the first 100)
_healthDataList.addAll(
(healthData.length < 100) ? healthData : healthData.sublist(0, 100));
// } catch (error) {
// debugPrint("Exception in getHealthDataFromTypes: $error");
// }
// save all the new data points (only the first 100)
_healthDataList.addAll(
(healthData.length < 100) ? healthData : healthData.sublist(0, 100));
} catch (error) {
debugPrint("Exception in getHealthDataFromTypes: $error");
}

// filter out duplicates
_healthDataList = Health().removeDuplicates(_healthDataList);
Expand Down

0 comments on commit 1a09f17

Please sign in to comment.