SyncEffectHandler<Effect, Msg> class abstract base

A synchronous EffectHandler implementation for processing effects.

This abstract class provides a structured way to define synchronous effect handling logic. Subclasses must implement the handle method, which processes the effect and emits messages without using asynchronous operations.

Usage:

To create a custom synchronous effect handler, subclass SyncEffectHandler and implement the handle method. The handle method will be invoked whenever an effect of the specified type is triggered.

Example:

final class MySyncEffectHandler extends SyncEffectHandler<MyEffect, MyMsg> {
  @override
  Null handle(MyEffect effect, MsgEmitter<MyMsg> emit) {
    if (effect.shouldEmit) {
      emit(MyMsg.success(effect.data));
    }
  }
}
Implemented types
Annotations
  • @experimental

Constructors

SyncEffectHandler()
Creates a SyncEffectHandler.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Effect effect, MsgEmitter<Msg> emit) → void
Invokes the handle method to process the effect synchronously.
override
handle(Effect effect, MsgEmitter<Msg> emit) Null
Defines the synchronous logic for processing the effect.
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