Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/health/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ class HealthAppState extends State<HealthApp> {
value: 22,
type: HealthDataType.LEAN_BODY_MASS,
startTime: earlier,
endTime: now,
);
endTime: now);

// specialized write methods
success &= await health.writeBloodOxygen(
Expand Down Expand Up @@ -400,6 +399,12 @@ class HealthAppState extends State<HealthApp> {
startTime: earlier,
endTime: now,
recordingMethod: RecordingMethod.manual);
success &= await health.writeHealthData(
value: 4.3,
type: HealthDataType.UV_INDEX,
startTime: earlier,
endTime: now,
recordingMethod: RecordingMethod.manual);
}

setState(() {
Expand Down
1 change: 1 addition & 0 deletions packages/health/example/lib/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const List<HealthDataType> dataTypesIOS = [
HealthDataType.MENSTRUATION_FLOW,
HealthDataType.WATER_TEMPERATURE,
HealthDataType.UNDERWATER_DEPTH,
HealthDataType.UV_INDEX,
];

/// List of data types available on Android.
Expand Down
5 changes: 5 additions & 0 deletions packages/health/ios/Classes/SwiftHealthPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin {
let MENSTRUATION_FLOW = "MENSTRUATION_FLOW"
let WATER_TEMPERATURE = "WATER_TEMPERATURE"
let UNDERWATER_DEPTH = "UNDERWATER_DEPTH"
let UV_INDEX = "UV_INDEX"


// Health Unit types
Expand Down Expand Up @@ -1670,6 +1671,10 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin {

dataTypesDict[WATER_TEMPERATURE] = HKQuantityType.quantityType(forIdentifier: .waterTemperature)!
dataTypesDict[UNDERWATER_DEPTH] = HKQuantityType.quantityType(forIdentifier: .underwaterDepth)!

dataTypesDict[UV_INDEX] = HKSampleType.quantityType(forIdentifier: .uvExposure)!
dataQuantityTypesDict[UV_INDEX] = HKQuantityType.quantityType(forIdentifier: .uvExposure)!

}

// Concatenate heart events, headache and health data types (both may be empty)
Expand Down
1 change: 1 addition & 0 deletions packages/health/lib/health.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/health/lib/src/heath_data_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ enum HealthDataType {
HEADACHE_SEVERE,
HEADACHE_UNSPECIFIED,
NUTRITION,
UV_INDEX,
// HealthKit Characteristics
GENDER,
BIRTH_DATE,
Expand Down Expand Up @@ -212,6 +213,8 @@ const List<HealthDataType> dataTypeKeysIOS = [
HealthDataType.MENSTRUATION_FLOW,
HealthDataType.WATER_TEMPERATURE,
HealthDataType.UNDERWATER_DEPTH,
HealthDataType.UV_INDEX,
HealthDataType.TOTAL_CALORIES_BURNED,
];

/// List of data types available on Android
Expand Down Expand Up @@ -362,6 +365,7 @@ const Map<HealthDataType, HealthDataUnit> dataTypeToUnit = {
HealthDataType.MENSTRUATION_FLOW: HealthDataUnit.NO_UNIT,
HealthDataType.WATER_TEMPERATURE: HealthDataUnit.DEGREE_CELSIUS,
HealthDataType.UNDERWATER_DEPTH: HealthDataUnit.METER,
HealthDataType.UV_INDEX: HealthDataUnit.COUNT,

// Health Connect
HealthDataType.TOTAL_CALORIES_BURNED: HealthDataUnit.KILOCALORIE,
Expand Down