CallbackController class abstract
Limits the frequency with which a callback is called to one call per duration.
To run the callback as soon as possible use CallbackController.limiter. To delay the execution by duration use CallbackController.delayer.
- Implementers
Constructors
- CallbackController({required Duration duration})
- CallbackController.delayer({required Duration duration})
-
Waits for
durationbefore running a callback.factory - CallbackController.limiter({required Duration duration})
-
Runs a callback as soon as possible and limits the calling frequency
to one call per
duration.factory
Properties
- current ↔ TimeStampedCallbackControllerState
-
The current state.
getter/setter pair
- duration → Duration
-
After the event delaying is added the stream
will wait for at least duration before the event
CallbackControllerState.ready is added.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasTimedOut → bool
-
Returns
trueif the last state added to stream was delaying and DateTime.now is after current.dateTimeStamp plus duration.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
CallbackControllerState> -
A stream with events of type CallbackControllerState.
no setter
Methods
-
close(
) → Future - Closes the controller such that no further events will be added to stream. Any unfinished timers will be cancelled.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
FutureOr< void> callback()) → void -
Runs
callbackand adds events to stream. -
runAsync(
FutureOr< void> callback()) → Future<void> -
Runs and awaits
callbackand adds events to stream. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited