Sample<Harmonized extends Payload?> class
abstract
Equivalent of Sample from HealthConnectReporter https://github.com/kvs-coder/HealthConnectReporter
One record stored in Health Connect. In JSON a sample carries
a type discriminator with its healthType identifier, e.g. heart_rate.
id names the stored record, clientRecordId and clientRecordVersion the app's own key and version; update and delete send all three.
Supports map representation.
Has a Sample.from constructor to create instances from JSON payload coming from Android native code and a generic Harmonized object, null for records without values.
Has a factory method for creating a specific instance of types:
- ActiveCaloriesBurned
- BasalBodyTemperature
- BasalMetabolicRate
- BloodGlucose
- BloodPressure
- BodyFat
- BodyTemperature
- BodyWaterMass
- BoneMass
- CervicalMucus
- CyclingPedalingCadence
- Distance
- ElevationGained
- ExerciseSession
- FloorsClimbed
- HeartRate
- HeartRateVariabilityRmssd
- Height
- Hydration
- IntermenstrualBleeding
- LeanBodyMass
- MenstruationFlow
- MenstruationPeriod
- MindfulnessSession
- Nutrition
- OvulationTest
- OxygenSaturation
- PlannedExerciseSession
- Power
- RespiratoryRate
- RestingHeartRate
- SexualActivity
- SkinTemperature
- SleepSession
- Speed
- Steps
- StepsCadence
- TotalCaloriesBurned
- Vo2Max
- Weight
- WheelchairPushes
- Mixed-in types
- Implementers
Constructors
- Sample({required int startTimestamp, required Harmonized harmonized, String? id, String? clientRecordId, int? clientRecordVersion, int? startZoneOffsetSeconds, int? endZoneOffsetSeconds, RecordingMethod? recordingMethod, Device? device, DataOrigin? dataOrigin, int? lastModifiedTimestamp})
-
const
-
Sample.from(Map<
String, dynamic> json, Harmonized harmonized) - General constructor from JSON payload
Properties
- clientRecordId → String?
-
Your own id for the record, kept by Health Connect;
inserting it again updates the record
final
- clientRecordVersion → int?
-
Your own version of clientRecordId; Health Connect keeps the highest
final
- dataOrigin → DataOrigin?
-
The app that wrote the record; set by Health Connect
final
- device → Device?
-
The device that recorded the data
final
- endTimestamp → int?
-
End time, epoch milliseconds; null for instantaneous records
no setter
- endZoneOffsetSeconds → int?
-
Zone offset at endTimestamp in seconds; null means unknown
final
- harmonized → Harmonized
-
The measured values; null for records without values
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- healthType → HealthType
-
The data type of this sample
no setter
- id → String?
-
Health Connect id of the stored record; null until it is inserted
final
- lastModifiedTimestamp → int?
-
Last modification time, epoch milliseconds; set by Health Connect
final
-
map
→ Map<
String, dynamic> -
General map representation, with the
typediscriminatorno setteroverride - recordingMethod → RecordingMethod?
-
How the record was recorded; RecordingMethod.manualEntry
when written as null
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startTimestamp → int
-
Start time (the measurement time of an instantaneous record),
epoch milliseconds
final
- startZoneOffsetSeconds → int?
-
Zone offset at startTimestamp in seconds; null means unknown
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
collect(
List list) → List< Sample< Payload?> > - factory for a list of samples, given as maps or JSON strings.
-
factory(
Map< String, dynamic> json) → Sample<Payload?> -
Factory method to create the sample its
typediscriminator names. Throws an InvalidValueException for an unknown type, so no sample is dropped silently.