MagnetometerDatum class

A Datum that holds magnetometer data collected from the native magnetometer on the phone.

Magnetometers measure the ambient magnetic field surrounding the sensor, returning values in microteslas μT for each three-dimensional axis.

Consider that these samples may bear effects of Earth's magnetic field as well as local factors such as the metal of the device itself or nearby magnets, though most devices compensate for these factors.

A compass is an example of a general utility for magnetometer data.

Inheritance
Annotations
  • @JsonSerializable(fieldRename: FieldRename.snake, includeIfNull: false)

Constructors

MagnetometerDatum({bool multiDatum = false, double? x, double? y, double? z})
MagnetometerDatum.fromJson(Map<String, dynamic> json)
factory
MagnetometerDatum.fromMagnetometerEvent(MagnetometerEvent event, {bool multiDatum = false})
factory

Properties

format ↔ DataFormat
The DataFormat of this type of Datum.
getter/setter pairinherited-setteroverride-getter
hashCode int
The hash code for this object.
no setterinherited
id String?
An identifier for this Datum, unique across all data generated. If this datum is part of a MultiDatum, then this id is null.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp DateTime
The UTC timestamp when this data was generated on the device.
getter/setter pairinherited
x double?
The ambient magnetic field in the x axis surrounding the sensor in microteslas μT.
getter/setter pair
y double?
The ambient magnetic field in the y axis surrounding the sensor in microteslas μT.
getter/setter pair
z double?
The ambient magnetic field in the z axis surrounding the sensor in microteslas μT.
getter/setter pair

Methods

equivalentTo(ConditionalEvent? event) bool
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Return a JSON encoding of this datum.
override
toString() String
A string representation of this object.
override

Operators

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