MeasurementStateManager class

Manages the state of measurement recording operations for a single device.

Tracks elapsed time, emits progress events, and detects completion either through timer expiration or device state polling.

Inheritance

Constructors

MeasurementStateManager({required String deviceId})

Properties

currentProgress MeasurementProgress
Current progress state (last emitted).
no setterinherited
deviceId String
finalinherited
elapsedSeconds int
Seconds elapsed since measurement started.
no setter
hashCode int
The hash code for this object.
no setterinherited
idleState MeasurementProgress
Returns the idle state for this operation type.
no setteroverride
isActive bool
Whether an operation is currently active.
getter/setter pairinherited
progressStream Stream<MeasurementProgress>
Stream of progress events.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalSeconds int
Total measurement duration in seconds.
no setter

Methods

completeMeasurement() → void
Called when device state indicates measurement is complete.
dispose() → void
Disposes the manager and closes the stream.
override
emitProgress(MeasurementProgress progress) → void
Emits a progress event to subscribers.
inherited
failMeasurement(String message, [int? code]) → void
Marks the measurement as failed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the operation state to idle.
override
startMeasurement({required int durationSeconds}) → void
Starts tracking a new measurement.
toString() String
A string representation of this object.
inherited
updateFromDeviceState({required int measurementState}) → void
Updates progress based on device state polling.

Operators

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