ThumperBloc<E> constructor
ThumperBloc<E> ()
ThumperBloc accepts
- A non-empty Iterable
- A non-empty _iterator derived from the iterable.
- A
Spectrum
of allowed thumper frequency values. - A factory func that accepts a frequency and returns a Stream
- A limit to automatic thumping. Hitting it automatically pauses.
Implementation
ThumperBloc(
this._iterable,
this._iterator,
this._spectrum,
this._timerFactoryFunc,
this.autoThumpLimit,
this._log,
) : assert(_iterable.isNotEmpty, 'iterable cannot be empty'),
assert(
_iterator.current != null, ' iterator must have a current value'),
assert(autoThumpLimit > 0, 'autoThumpLimit must be > 0'),
_autoThumpsRemaining = autoThumpLimit,
super(ThumperState.init(
_iterator.current,
Frequency(_spectrum, 0),
)) {
on<ThumperEventResumed>(_onResumed);
on<ThumperEventPaused>(_onPaused);
on<ThumperEventDecreased>(_onDecreased);
on<ThumperEventIncreased>(_onIncreased);
on<ThumperEventThumpedAutomatically>(_onThumpedAutomatically);
on<ThumperEventThumpedManually>(_onThumpedManually);
on<ThumperEventRewound>(_onRewound);
}