isEqual<T> method

ActorBuilder isEqual<T>(
  1. T message,
  2. FutureOr<void> actor(
    1. ActorContext context,
    2. T message
    )
)

Handle a message if the message is equal to the given message parameter.

Implementation

ActorBuilder isEqual<T>(T message, FutureOr<void> Function(ActorContext context, T message) actor) {
  _conditions.add(_Condition(
    (ctx, msg) => msg == message,
    (context, message) => actor(context, message as T),
  ));
  return this;
}