on<A extends FloatyAction> method

void on<A extends FloatyAction>(
  1. ActionKey<A> key,
  2. FutureOr<void> handler(
    1. A action
    )
)

Registers a handler for the action class identified by key.

The handler runs whenever the other side dispatches an action whose type matches key.type.

Implementation

void on<A extends FloatyAction>(
  ActionKey<A> key,
  FutureOr<void> Function(A action) handler,
) {
  _handlers[key.type] = _HandlerEntry<A>(
    fromJson: key.fromJson,
    handler: handler,
  );
}