kvs-coder / health_kit_reporter

A Flutter wrapper for the HealthKitReporter library
https://pub.dev/packages/health_kit_reporter
MIT License
38 stars 38 forks source link

Workout metadata missing. #58

Open ShineYang opened 1 year ago

ShineYang commented 1 year ago

Describe the bug When I use HealthKitReporter.workoutQuery(predicate) to retrieve workout data, harmonized.metadata always returns null.

To Reproduce try { final workouts = await HealthKitReporter.workoutQuery(predicate); workouts.forEach((element) { print('metadata: ${element.harmonized.metadata}'); }); } catch (e) { print(e); }

Expected behavior The metadata should look like this: {HKAverageMETs: 4.85739 kcal/hr·kg, HKIndoorWorkout: 0, HKWeatherTemperature: 52.016 degF, HKWeatherHumidity: 7600 %, HKTimeZone: Asia/Shanghai, HKElevationAscended: 2403 cm}

Additional context I think the reason might be that there's something wrong with Metadata.make()in the native code.

jeybs commented 1 year ago

Hoping for this fix.. need elevation gain for my existing project

appsowner commented 1 year ago

I have solution....for workout. i can use substrac 1 seconds for startDate and add 1 seconds for endDate.!

Regards!