SensorEvent class
This class represents a {@link android.hardware.Sensor Sensor} event and holds information such as the sensor's type, the time-stamp, accuracy and of course the sensor's {@link SensorEvent#values data}.
The coordinate-system is defined relative to the screen of the phone in its default orientation. The axes are not swapped when the device's screen orientation changes.
The X axis is horizontal and points to the right, the Y axis is vertical and points up and the Z axis points towards the outside of the front face of the screen. In this system, coordinates behind the screen have negative Z values.
Note: This coordinate system is different from the one used in the Android 2D APIs where the origin is in the top-left corner.
@see SensorManager @see SensorEvent @see Sensor
Constructors
-
SensorEvent(Sensor sensor, int accuracy, int timestamp, List<
double> values) -
const
- SensorEvent.fromJson(String source)
-
factory
-
SensorEvent.fromMap(Map<
String, dynamic> map) -
factory
Properties
- accuracy → int
-
The accuracy of this event. See {@link android.hardware.SensorManager
SensorManager} for details.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sensor → Sensor
-
The sensor that generated this event. See
{@link android.hardware.SensorManager SensorManager} for details.
final
- timestamp → int
-
The time in nanoseconds at which the event happened. For a given sensor,
each new sensor event should be monotonically increasing using the same
time base as {@link android.os.SystemClock#elapsedRealtimeNanos()}.
final
-
values
→ List<
double> -
The length and contents of the {@link #values values} array depends on
which {@link android.hardware.Sensor sensor} type is being monitored (see
also {@link SensorEvent} for a definition of the coordinate system used).
final
Methods
-
copyWith(
{Sensor? sensor, int? accuracy, int? timestamp, List< double> ? values}) → SensorEvent -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → String -
toMap(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
covariant SensorEvent other) → bool -
The equality operator.
override