ButtonDebouncer class final

Turns raw hardware-button events into single presses.

Many UVC cameras report both press (state 1) and release (state 0), and some bounce, reporting several presses per click. Only presses are passed on, and presses within window of the previous one are dropped.

Constructors

ButtonDebouncer({Duration window = const Duration(milliseconds: 700), DateTime clock()?})
Creates a debouncer.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
window Duration
Minimum time between two reported presses.
final

Methods

accept(int state) bool
Returns whether a raw event with state counts as a new press.
bind(Stream<int> states) Stream<void>
Applies accept to a stream of raw button states.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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