diff --git a/android/src/main/kotlin/dev/duynp/flutter_health_connect/FlutterHealthConnectPlugin.kt b/android/src/main/kotlin/dev/duynp/flutter_health_connect/FlutterHealthConnectPlugin.kt index 201f9b3..36f4036 100644 --- a/android/src/main/kotlin/dev/duynp/flutter_health_connect/FlutterHealthConnectPlugin.kt +++ b/android/src/main/kotlin/dev/duynp/flutter_health_connect/FlutterHealthConnectPlugin.kt @@ -396,7 +396,7 @@ class FlutterHealthConnectPlugin(private var channel: MethodChannel? = null) : F BLOOD_GLUCOSE -> BloodGlucoseRecord( time = Instant.parse(recordMap["time"] as String), zoneOffset = if (recordMap["zoneOffset"] != null) ZoneOffset.ofHours(recordMap["zoneOffset"] as Int) else null, - level = BloodGlucose.millimolesPerLiter(recordMap["level"] as Double), + level = BloodGlucose.milligramsPerDeciliter(recordMap["level"] as Double), specimenSource = recordMap["specimenSource"] as Int, mealType = recordMap["mealType"] as Int, relationToMeal = recordMap["relationToMeal"] as Int, diff --git a/lib/src/records/blood_glucose_record.dart b/lib/src/records/blood_glucose_record.dart index 70ff8fe..1d4aaed 100644 --- a/lib/src/records/blood_glucose_record.dart +++ b/lib/src/records/blood_glucose_record.dart @@ -24,8 +24,8 @@ class BloodGlucoseRecord extends InstantaneousRecord { this.relationToMeal = RelationToMeal.unknown, this.mealType = MealType.unknown, metadata}) - : assert(level.value <= _maxLevel.value), - assert(level.value >= _minLevel.value), + : assert(level.inMilligramsPerDeciliter <= _maxLevel.inMilligramsPerDeciliter), + assert(level.inMilligramsPerDeciliter >= _minLevel.inMilligramsPerDeciliter), metadata = metadata ?? Metadata.empty(); static const BloodGlucose _maxLevel = BloodGlucose.millimolesPerLiter(50.0);