Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main.dart #945

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading