DataSourceListener class Sensor Data Source

Receives events and sensor data from a DataSource.

Use a DataSourceListener to react to data-source events such as:

  • playing status changes,
  • interruptions to data flow (sensor stopped, app backgrounded, etc.),
  • new sensor data arrivals, and
  • progress updates during playback.

Create an instance with the factory and supply the callbacks you need. The listener can then be registered with a DataSource for specific DataType using DataSource.addListener and removed with DataSource.removeListener or DataSource.removeListenerAllDataTypes.

For position data sources, consider using PositionService which provides built-in support for registering listeners and managing position updates.

See also:

  • DataSource — Source of events and data.
  • PositionService - Service providing position data, with the ability to register for position updates.

Constructors

DataSourceListener({void onPlayingStatusChanged(DataType dataType, PlayingStatus status)?, void onDataInterruptionEvent(DataType dataType, DataInterruptionReason reason, bool ended)?, void onNewData(SenseData data)?, void onProgressChanged(int)?})
Creates a new DataSourceListener and optionally registers the provided callbacks.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
handleEvent(Map arguments) → void
Method called when event is called from the native side.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOnDataInterruptionEvent(void onDataInterruptionEvent(DataType dataType, DataInterruptionReason reason, bool ended)) → void
Register a callback that is invoked when data for a data type is interrupted.
registerOnNewData(void onNewData(SenseData data)) → void
Register a callback invoked when new SenseData arrives.
registerOnPlayingStatusChanged(void onPlayingStatusChanged(DataType dataType, PlayingStatus status)) → void
Register a callback invoked when a data type's playing status changes.
registerOnProgressChanged(void onProgressChanged(int progress)) → void
Register a callback invoked when playback or processing progress updates.
toString() String
A string representation of this object.
inherited

Operators

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