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

[Health 11.1.0] Missing WorkoutHealthValue register #1051

Open
arodriguez1996 opened this issue Sep 25, 2024 · 1 comment
Open

[Health 11.1.0] Missing WorkoutHealthValue register #1051

arodriguez1996 opened this issue Sep 25, 2024 · 1 comment
Labels
bugfix a bug fix

Comments

@arodriguez1996
Copy link

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

  • Device: iPhone 16 Pro Max
  • OS: iOS 18.0

Describe the bug

For any workout created by the Health app, you cannot use the fromJson method for the WorkoutHealthValue type because it is not registered in carp_serializable package.

To Reproduce

try to parce

 var entry = {uuid: A91A2F10-3D7B-486A-B140-5ADCD3C9C6D0, value: {__type: WorkoutHealthValue, workoutActivityType: RUNNING, totalEnergyBurned: 100, totalEnergyBurnedUnit: KILOCALORIE, totalDistance: 2000, totalDistanceUnit: METER}, type: WORKOUT, unit: NO_UNIT, dateFrom: 2024-09-24T17:34:00.000, dateTo: 2024-09-24T17:57:00.000, sourcePlatform: appleHealth, sourceDeviceId: 756B1A7A-C972-4BDB-9748-0D4749CF299C, sourceId: com.apple.Health, sourceName: Salud, recordingMethod: manual, workoutSummary: {workoutType: running, totalDistance: 2000, totalEnergyBurned: 100, totalSteps: 0}};
 
  HealthDataPoint.fromJson(entry);

Expected behavior

parse the json to HealthDataPoint entity

Actual behavior

  SerializationException - A 'fromJson' function was not found in the FromJsonFactory for the type 'WorkoutHealthValue'. Register a Serializable class using the 'FromJsonFactory().register()' method.
If you are using CARP Mobile Sensing, you can ensure json initialization by calling'CarpMobileSensing.ensureInitialized()' as part of your main method.


Stack trace: 
#0      FromJsonFactory.fromJson (package:carp_serializable/carp_serializable.dart:199:9)
#1      new HealthValue.fromJson (package:health/src/health_value_types.dart:11:25)
#2      _$HealthDataPointFromJson (package:health/health.g.dart:12:26)
#3      new HealthDataPoint.fromJson (package:health/src/health_data_point.dart:102:7)

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale es-PE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.93.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

@malik19995
Copy link

Facing this issue on iOS 18 and health version 11.1.0.

Please review and merge asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix a bug fix
Projects
None yet
Development

No branches or pull requests

2 participants