Skip to content

Commit 490525b

Browse files
committed
Fix adding mindfulness result in crash in iOS
1 parent 5cbe7fb commit 490525b

2 files changed

Lines changed: 204 additions & 115 deletions

File tree

packages/health/example/lib/main.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,15 @@ class HealthAppState extends State<HealthApp> {
409409
type: HealthDataType.HEART_RATE_VARIABILITY_RMSSD,
410410
startTime: earlier,
411411
endTime: now);
412+
413+
// Mindfulness value should be counted based on start and end time
414+
success &= await health.writeHealthData(
415+
value: 10,
416+
type: HealthDataType.MINDFULNESS,
417+
startTime: earlier,
418+
endTime: now,
419+
recordingMethod: RecordingMethod.automatic,
420+
);
412421
}
413422

414423
// Available on iOS or iOS 16.0+ only

0 commit comments

Comments
 (0)