DebounceEffectHandler<Effect, Msg> class
final
An EffectHandler implementation that adds a debounce mechanism to effect handling.
Debouncing ensures that effect handling is postponed until a specified duration has elapsed since the last effect invocation. If new effects are scheduled during the delay, the previous effect is canceled, and only the most recent effect is processed.
This is particularly useful in scenarios where effects are triggered in rapid succession, such as handling user input or network requests, and you want to limit the frequency of effect processing.
Example:
final debounceHandler = DebounceEffectHandler(
duration: const Duration(milliseconds: 300),
handler: myEffectHandler,
);
- Implemented types
-
- EffectHandler<
Effect, Msg> - Disposable
- EffectHandler<
- Annotations
-
- @experimental
Constructors
-
DebounceEffectHandler({required Duration duration, required EffectHandler<
Effect, Msg> handler}) - Creates a new DebounceEffectHandler.
Properties
Methods
-
call(
Effect effect, MsgEmitter< Msg> emit) → FutureOr<void> -
Handles an effect with debounce logic.
override
-
dispose(
) → Future< void> -
Cancels any currently scheduled effect handling.
override
-
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