Data class

Base class of all collected data, such as a location or a heart rate.

A probe or user task produces a Data object, which is wrapped in a Measurement with a timestamp and uploaded. This base class holds no values itself; subclasses add the fields.

Key points:

  • The data type (dataType) is derived from jsonType. By default this is dk.cachet.carp.<classname in lowercase>, e.g. dk.cachet.carp.geolocation for Geolocation.
  • Each subclass must be registered in FromJsonFactory to be deserialized.
  • Override equivalentTo to let triggers react to specific data values.

See also SensorData, InputData and the data type names in CarpDataTypes.

Inheritance
Implementers
Annotations
  • @JsonSerializable.new(includeIfNull: false, explicitToJson: true)

Constructors

Data()
Data.fromJson(Map<String, dynamic> json)
factory

Properties

$type ↔ String?
The type name written to __type in JSON; set to jsonType on creation.
getter/setter pairinherited
dataType → DataType
The type of this data as a DataType.
no setter
fromJsonFunction → Function
The generated function that converts a JSON map to an object of this type.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
jsonType → String
The __type used for JSON serialization of this class.
no setteroverride
recordId → String?
Stable identifier of the source record, if available; null by default.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

equivalentTo(Data other) → bool
Is this data equivalent to other?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Returns a JSON map of this object, including the __type property.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited