From fd556dc47d47d2149db5f1d543e481cb835d8fef Mon Sep 17 00:00:00 2001 From: Agil Setiawan Date: Mon, 21 Jul 2025 15:19:23 +0700 Subject: [PATCH 1/6] Update write health data to return object instead of boolean - Add write single health data example - Add write single workout data example --- .../cachet/plugins/health/HealthDataWriter.kt | 43 ++- packages/health/example/lib/main.dart | 275 +++++++++++------- .../health/ios/Classes/HealthDataWriter.swift | 25 +- packages/health/lib/src/health_plugin.dart | 48 ++- 4 files changed, 266 insertions(+), 125 deletions(-) diff --git a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthDataWriter.kt b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthDataWriter.kt index a3e47beee..026d221ac 100644 --- a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthDataWriter.kt +++ b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthDataWriter.kt @@ -4,6 +4,7 @@ import android.util.Log import androidx.health.connect.client.HealthConnectClient import androidx.health.connect.client.records.* import androidx.health.connect.client.records.metadata.Metadata +import androidx.health.connect.client.response.InsertRecordsResponse import androidx.health.connect.client.units.* import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel.Result @@ -43,17 +44,31 @@ class HealthDataWriter( val record = createRecord(type, startTime, endTime, value, recordingMethod) if (record == null) { - result.success(false) + result.success("") return } scope.launch { try { - healthConnectClient.insertRecords(listOf(record)) - result.success(true) + // Insert records into Health Connect + val insertResponse: InsertRecordsResponse = healthConnectClient.insertRecords(listOf(record)) + + // Extract UUID from the first inserted record + val insertedUUID = insertResponse.recordIdsList.firstOrNull() ?: "" + + if (insertedUUID.isEmpty()) { + Log.e("FLUTTER_HEALTH::ERROR", "UUID is empty! No records were inserted.") + } else { + Log.i( + "FLUTTER_HEALTH::SUCCESS", + "[Health Connect] Workout $insertedUUID was successfully added!" + ) + } + + result.success(insertedUUID) } catch (e: Exception) { Log.e("FLUTTER_HEALTH::ERROR", "Error writing $type: ${e.message}") - result.success(false) + result.success("") } } } @@ -76,7 +91,7 @@ class HealthDataWriter( val recordingMethod = call.argument("recordingMethod")!! if (!HealthConstants.workoutTypeMap.containsKey(type)) { - result.success(false) + result.success("") Log.w( "FLUTTER_HEALTH::ERROR", "[Health Connect] Workout type not supported" @@ -138,12 +153,22 @@ class HealthDataWriter( ) } - healthConnectClient.insertRecords(list) - result.success(true) + // Insert records into Health Connect + val insertResponse: InsertRecordsResponse = healthConnectClient.insertRecords(list) + + // Extract UUID from the first inserted record + val insertedUUID = insertResponse.recordIdsList.firstOrNull() ?: "" + + if (insertedUUID.isEmpty()) { + Log.e("FLUTTER_HEALTH::ERROR", "UUID is empty! No records were inserted.") + } + Log.i( "FLUTTER_HEALTH::SUCCESS", - "[Health Connect] Workout was successfully added!" + "[Health Connect] Workout $insertedUUID was successfully added!" ) + + result.success(insertedUUID) } catch (e: Exception) { Log.w( "FLUTTER_HEALTH::ERROR", @@ -151,7 +176,7 @@ class HealthDataWriter( ) Log.w("FLUTTER_HEALTH::ERROR", e.message ?: "unknown error") Log.w("FLUTTER_HEALTH::ERROR", e.stackTrace.toString()) - result.success(false) + result.success("") } } } diff --git a/packages/health/example/lib/main.dart b/packages/health/example/lib/main.dart index 1e2090668..d6d24c7bf 100644 --- a/packages/health/example/lib/main.dart +++ b/packages/health/example/lib/main.dart @@ -221,6 +221,45 @@ class HealthAppState extends State { } } + // Add single steps data (health data) + Future addSingleHealthData() async { + final now = DateTime.now(); + final earlier = now.subtract(const Duration(minutes: 20)); + + final healthDataPoint = await health.writeHealthData( + value: 2130, + type: HealthDataType.STEPS, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual, + ); + + bool success = healthDataPoint != null; + setState(() { + _state = success ? AppState.DATA_ADDED : AppState.DATA_NOT_ADDED; + }); + } + + // Add single running data (workout data) + Future addSingleWorkoutData() async { + final now = DateTime.now(); + final earlier = now.subtract(const Duration(minutes: 20)); + + final healthDataPoint = await health.writeWorkoutData( + activityType: HealthWorkoutActivityType.RUNNING, + title: "New RUNNING activity", + start: earlier, + end: now, + totalDistance: 2430, + totalEnergyBurned: 400, + ); + + bool success = healthDataPoint != null; + setState(() { + _state = success ? AppState.DATA_ADDED : AppState.DATA_NOT_ADDED; + }); + } + /// Add some random health data. /// Note that you should ensure that you have permissions to add the /// following data types. @@ -236,83 +275,97 @@ class HealthAppState extends State { // misc. health data examples using the writeHealthData() method success &= await health.writeHealthData( - value: 1.925, - type: HealthDataType.HEIGHT, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 1.925, + type: HealthDataType.HEIGHT, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 90, - type: HealthDataType.WEIGHT, - startTime: now, - recordingMethod: RecordingMethod.manual); + value: 90, + type: HealthDataType.WEIGHT, + startTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 90, - type: HealthDataType.HEART_RATE, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 90, + type: HealthDataType.HEART_RATE, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 90, - type: HealthDataType.STEPS, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 90, + type: HealthDataType.STEPS, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 200, - type: HealthDataType.ACTIVE_ENERGY_BURNED, - startTime: earlier, - endTime: now, - ); + value: 200, + type: HealthDataType.ACTIVE_ENERGY_BURNED, + startTime: earlier, + endTime: now, + ) != + null; success &= await health.writeHealthData( - value: 70, - type: HealthDataType.HEART_RATE, - startTime: earlier, - endTime: now); + value: 70, + type: HealthDataType.HEART_RATE, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 37, - type: HealthDataType.BODY_TEMPERATURE, - startTime: earlier, - endTime: now); + value: 37, + type: HealthDataType.BODY_TEMPERATURE, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 105, - type: HealthDataType.BLOOD_GLUCOSE, - startTime: earlier, - endTime: now); + value: 105, + type: HealthDataType.BLOOD_GLUCOSE, + startTime: earlier, + endTime: now) != + null; success &= await health.writeInsulinDelivery( 5, InsulinDeliveryReason.BOLUS, earlier, now); success &= await health.writeHealthData( - value: 1.8, - type: HealthDataType.WATER, - startTime: earlier, - endTime: now); + value: 1.8, + type: HealthDataType.WATER, + startTime: earlier, + endTime: now) != + null; // different types of sleep success &= await health.writeHealthData( - value: 0.0, - type: HealthDataType.SLEEP_REM, - startTime: earlier, - endTime: now); + value: 0.0, + type: HealthDataType.SLEEP_REM, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 0.0, - type: HealthDataType.SLEEP_ASLEEP, - startTime: earlier, - endTime: now); + value: 0.0, + type: HealthDataType.SLEEP_ASLEEP, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 0.0, - type: HealthDataType.SLEEP_AWAKE, - startTime: earlier, - endTime: now); + value: 0.0, + type: HealthDataType.SLEEP_AWAKE, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 0.0, - type: HealthDataType.SLEEP_DEEP, - startTime: earlier, - endTime: now); + value: 0.0, + type: HealthDataType.SLEEP_DEEP, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 22, - type: HealthDataType.LEAN_BODY_MASS, - startTime: earlier, - endTime: now); + value: 22, + type: HealthDataType.LEAN_BODY_MASS, + startTime: earlier, + endTime: now) != + null; // specialized write methods success &= await health.writeBloodOxygen( @@ -321,13 +374,14 @@ class HealthAppState extends State { endTime: now, ); success &= await health.writeWorkoutData( - activityType: HealthWorkoutActivityType.AMERICAN_FOOTBALL, - title: "Random workout name that shows up in Health Connect", - start: now.subtract(const Duration(minutes: 15)), - end: now, - totalDistance: 2430, - totalEnergyBurned: 400, - ); + activityType: HealthWorkoutActivityType.AMERICAN_FOOTBALL, + title: "Random workout name that shows up in Health Connect", + start: now.subtract(const Duration(minutes: 15)), + end: now, + totalDistance: 2430, + totalEnergyBurned: 400, + ) != + null; success &= await health.writeBloodPressure( systolic: 90, diastolic: 80, @@ -406,51 +460,58 @@ class HealthAppState extends State { if (Platform.isIOS) { success &= await health.writeHealthData( - value: 30, - type: HealthDataType.HEART_RATE_VARIABILITY_SDNN, - startTime: earlier, - endTime: now); + value: 30, + type: HealthDataType.HEART_RATE_VARIABILITY_SDNN, + startTime: earlier, + endTime: now) != + null; success &= await health.writeHealthData( - value: 1.5, // 1.5 m/s (typical walking speed) - type: HealthDataType.WALKING_SPEED, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 1.5, // 1.5 m/s (typical walking speed) + type: HealthDataType.WALKING_SPEED, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; } else { success &= await health.writeHealthData( - value: 2.0, // 2.0 m/s (typical jogging speed) - type: HealthDataType.SPEED, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 2.0, // 2.0 m/s (typical jogging speed) + type: HealthDataType.SPEED, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 30, - type: HealthDataType.HEART_RATE_VARIABILITY_RMSSD, - startTime: earlier, - endTime: now); + value: 30, + type: HealthDataType.HEART_RATE_VARIABILITY_RMSSD, + startTime: earlier, + endTime: now) != + null; } // Available on iOS or iOS 16.0+ only if (Platform.isIOS) { success &= await health.writeHealthData( - value: 22, - type: HealthDataType.WATER_TEMPERATURE, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 22, + type: HealthDataType.WATER_TEMPERATURE, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 55, - type: HealthDataType.UNDERWATER_DEPTH, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 55, + type: HealthDataType.UNDERWATER_DEPTH, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; success &= await health.writeHealthData( - value: 4.3, - type: HealthDataType.UV_INDEX, - startTime: earlier, - endTime: now, - recordingMethod: RecordingMethod.manual); + value: 4.3, + type: HealthDataType.UV_INDEX, + startTime: earlier, + endTime: now, + recordingMethod: RecordingMethod.manual) != + null; } setState(() { @@ -662,6 +723,20 @@ class HealthAppState extends State { WidgetStatePropertyAll(Colors.blue)), child: const Text("Add Data", style: TextStyle(color: Colors.white))), + TextButton( + onPressed: addSingleHealthData, + style: const ButtonStyle( + backgroundColor: + WidgetStatePropertyAll(Colors.blue)), + child: const Text("Add Steps Data", + style: TextStyle(color: Colors.white))), + TextButton( + onPressed: addSingleWorkoutData, + style: const ButtonStyle( + backgroundColor: + WidgetStatePropertyAll(Colors.blue)), + child: const Text("Add Running Data", + style: TextStyle(color: Colors.white))), TextButton( onPressed: deleteData, style: const ButtonStyle( diff --git a/packages/health/ios/Classes/HealthDataWriter.swift b/packages/health/ios/Classes/HealthDataWriter.swift index 1ea3bf301..6e030282b 100644 --- a/packages/health/ios/Classes/HealthDataWriter.swift +++ b/packages/health/ios/Classes/HealthDataWriter.swift @@ -64,7 +64,17 @@ class HealthDataWriter { print("Error Saving \(type) Sample: \(err.localizedDescription)") } DispatchQueue.main.async { - result(success) + if success { + // Return the UUID of the saved object + if let savedSample = sample as? HKObject { + print("Saved: \(savedSample.uuid.uuidString)") + result(savedSample.uuid.uuidString) // Return UUID as String + } else { + result("") + } + } + + result("") } }) } @@ -353,7 +363,18 @@ class HealthDataWriter { print("Error Saving Workout. Sample: \(err.localizedDescription)") } DispatchQueue.main.async { - result(success) + + if success { + // Return the UUID of the saved object + if let savedSample = workout as? HKWorkout { + print("Saved: \(savedSample.uuid.uuidString)") + result(savedSample.uuid.uuidString) // Return UUID as String + } else { + result("") + } + } + + result("") } }) } diff --git a/packages/health/lib/src/health_plugin.dart b/packages/health/lib/src/health_plugin.dart index d92671d25..e139f561e 100644 --- a/packages/health/lib/src/health_plugin.dart +++ b/packages/health/lib/src/health_plugin.dart @@ -456,7 +456,7 @@ class Health { /// Write health data. /// - /// Returns true if successful, false otherwise. + /// Returns created HealthDataPoint if successful, null otherwise. /// /// Parameters: /// * [value] - the health data's value in double @@ -473,7 +473,7 @@ class Health { /// /// Values for Sleep and Headache are ignored and will be automatically assigned /// the default value. - Future writeHealthData({ + Future writeHealthData({ required double value, HealthDataUnit? unit, required HealthDataType type, @@ -538,8 +538,15 @@ class Health { 'endTime': endTime.millisecondsSinceEpoch, 'recordingMethod': recordingMethod.toInt(), }; - bool? success = await _channel.invokeMethod('writeData', args); - return success ?? false; + + String uuid = '${await _channel.invokeMethod('writeData', args)}'; + + final healthPoint = await getHealthDataByUUID( + uuid: uuid, + type: type, + ); + + return healthPoint; } /// Deletes all records of the given [type] for a given period of time. @@ -681,12 +688,15 @@ class Health { bool? success; if (Platform.isIOS) { - success = await writeHealthData( - value: saturation, - type: HealthDataType.BLOOD_OXYGEN, - startTime: startTime, - endTime: endTime, - recordingMethod: recordingMethod); + final healthPoint = await writeHealthData( + value: saturation, + type: HealthDataType.BLOOD_OXYGEN, + startTime: startTime, + endTime: endTime, + recordingMethod: recordingMethod, + ); + + success = healthPoint != null; } else if (Platform.isAndroid) { Map args = { 'value': saturation, @@ -695,7 +705,9 @@ class Health { 'dataTypeKey': HealthDataType.BLOOD_OXYGEN.name, 'recordingMethod': recordingMethod.toInt(), }; - success = await _channel.invokeMethod('writeBloodOxygen', args); + // Check if UUID is not empty + success = + '${await _channel.invokeMethod('writeBloodOxygen', args)}'.isNotEmpty; } return success ?? false; } @@ -1350,7 +1362,7 @@ class Health { /// Write workout data to Apple Health or Google Health Connect. /// - /// Returns true if the workout data was successfully added. + /// Returns created HealthDataPoint if the workout data was successfully added, null otherwise. /// /// Parameters: /// - [activityType] The type of activity performed. @@ -1365,7 +1377,7 @@ class Health { /// - [title] The title of the workout. /// *ONLY FOR HEALTH CONNECT* Default value is the [activityType], e.g. "STRENGTH_TRAINING". /// - [recordingMethod] The recording method of the data point, automatic by default (on iOS this can only be automatic or manual). - Future writeWorkoutData({ + Future writeWorkoutData({ required HealthWorkoutActivityType activityType, required DateTime start, required DateTime end, @@ -1402,7 +1414,15 @@ class Health { 'title': title, 'recordingMethod': recordingMethod.toInt(), }; - return await _channel.invokeMethod('writeWorkoutData', args) == true; + + String uuid = '${await _channel.invokeMethod('writeWorkoutData', args)}'; + + final healthPoint = await getHealthDataByUUID( + uuid: uuid, + type: HealthDataType.WORKOUT, + ); + + return healthPoint; } /// Check if the given [HealthWorkoutActivityType] is supported on the iOS platform From 8ade6992d6db35765b0713f864618c40a80e5efc Mon Sep 17 00:00:00 2001 From: Alireza Hajebrahimi <6937697+iarata@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:49:22 +0200 Subject: [PATCH 2/6] allow more than one version for device_info_plus --- packages/health/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/health/pubspec.yaml b/packages/health/pubspec.yaml index a55907070..b4f8185d7 100644 --- a/packages/health/pubspec.yaml +++ b/packages/health/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter intl: '>=0.18.0 <0.21.0' - device_info_plus: '12.1.0' + device_info_plus: '^12.1.0' json_annotation: ^4.9.0 carp_serializable: ^2.0.1 # polymorphic json serialization From 2562a5d0ba6ac207075dad9f2313c61c0ec09086 Mon Sep 17 00:00:00 2001 From: "Jakob E. Bardram" Date: Thu, 18 Sep 2025 14:21:50 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f5e02058..93e8901ea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CARP Flutter plugins -This repo contains the source code for Flutter first-party plugins developed by developers at the [Copenhagen Research Platform (CARP)](http://www.carp.dk/) at The Technical University of Denmark. +This repo contains the source code for Flutter first-party plugins maintained by the [Copenhagen Research Platform (CARP)](http://www.carp.dk/) team at the Technical University of Denmark. Check the `packages` directory for all plugins. Flutter plugins enable access to platform-specific APIs using a platform channel. From 0ed318e173c87155ee14db16980cf750a95c6f74 Mon Sep 17 00:00:00 2001 From: "Jakob E. Bardram" Date: Thu, 18 Sep 2025 14:25:17 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 93e8901ea..f62f3842f 100644 --- a/README.md +++ b/README.md @@ -36,18 +36,8 @@ Please check existing issues and file any new issues, bugs, or feature requests ## Contributing As part of the open-source Flutter ecosystem, we would welcome any help in maintaining and enhancing these plugins. -We (i.e., CACHET) have limited resources for maintaining these plugins and we rely on **your** help in this. -We welcome any contribution -- from small error corrections in the documentation, to bug fixes, to large features enhacements, or even new features in a plugin. -If you wish to contribute to any of the plugins in this repo, -please review our [contribution guide](https://github.com/cph-cachet/flutter-plugins/CONTRIBUTING.md), -and send a [pull request](https://github.com/cph-cachet/flutter-plugins/pulls). - - -In general, if you wish to contribute a new plugin to the Flutter ecosystem, please -see the documentation for [developing packages](https://flutter.io/developing-packages/) and -[platform channels](https://flutter.io/platform-channels/). You can store -your plugin source code in any GitHub repository (the present repo is only -intended for plugins developed by the core CARP team). Once your plugin -is ready you can [publish](https://flutter.io/developing-packages/#publish) -to the [pub repository](https://pub.dartlang.org/). +We (i.e., the CARP team) have limited resources for maintaining these plugins, and we rely on **your** help in this. +We welcome any contribution - from small error corrections in the documentation, to bug fixes, to large feature enhancements, or even new features in a plugin. +If you wish to contribute to any of the plugins in this repo, please review our [contribution guide](https://github.com/cph-cachet/flutter-plugins/CONTRIBUTING.md) and send a [pull request](https://github.com/cph-cachet/flutter-plugins/pulls). + From 6e9010744310fafc13f21883583473b3c120a909 Mon Sep 17 00:00:00 2001 From: "Jakob E. Bardram" Date: Thu, 18 Sep 2025 14:26:53 +0200 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f62f3842f..d08af73a1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ For more information about plugins and how to use them, see ## Plugins These are the available plugins in this repository. -| Plugin | Description | Android | iOS | http://pub.dev/ | +| Plugin | Description | Android | iOS | pub.dev | |--------|-------------|:-------:|:---:|:---------:| | [screen_state](./packages/screen_state) | Track screen state changes | ✔️ | ✔️ | [![pub package](https://img.shields.io/pub/v/screen_state.svg)](https://pub.dartlang.org/packages/screen_state) | | [light](./packages/light) | Track light sensor readings | ✔️ | ❌ | [![pub package](https://img.shields.io/pub/v/light.svg)](https://pub.dartlang.org/packages/light) | From 24f4de81918f2f42819b69432169a3621db01f75 Mon Sep 17 00:00:00 2001 From: Agil Setiawan Date: Tue, 30 Sep 2025 10:12:51 +0700 Subject: [PATCH 6/6] Update writeHealthData and writeWorkoutData to return uuid String --- packages/health/lib/src/health_plugin.dart | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/health/lib/src/health_plugin.dart b/packages/health/lib/src/health_plugin.dart index 42472cd8b..57d8f4a10 100644 --- a/packages/health/lib/src/health_plugin.dart +++ b/packages/health/lib/src/health_plugin.dart @@ -506,7 +506,7 @@ class Health { /// /// Values for Sleep and Headache are ignored and will be automatically assigned /// the default value. - Future writeHealthData({ + Future writeHealthData({ required double value, HealthDataUnit? unit, required HealthDataType type, @@ -582,9 +582,7 @@ class Health { String uuid = '${await _channel.invokeMethod('writeData', args)}'; - final healthPoint = await getHealthDataByUUID(uuid: uuid, type: type); - - return healthPoint; + return uuid; } /// Deletes all records of the given [type] for a given period of time. @@ -1506,7 +1504,7 @@ class Health { /// - [title] The title of the workout. /// *ONLY FOR HEALTH CONNECT* Default value is the [activityType], e.g. "STRENGTH_TRAINING". /// - [recordingMethod] The recording method of the data point, automatic by default (on iOS this can only be automatic or manual). - Future writeWorkoutData({ + Future writeWorkoutData({ required HealthWorkoutActivityType activityType, required DateTime start, required DateTime end, @@ -1552,12 +1550,7 @@ class Health { String uuid = '${await _channel.invokeMethod('writeWorkoutData', args)}'; - final healthPoint = await getHealthDataByUUID( - uuid: uuid, - type: HealthDataType.WORKOUT, - ); - - return healthPoint; + return uuid; } /// Check if the given [HealthWorkoutActivityType] is supported on the iOS platform