addDispatcher<T extends Component> static method

void addDispatcher<T extends Component>(
  1. Component component,
  2. ComponentKey key,
  3. T create()
)

Implementation

static void addDispatcher<T extends Component>(
  Component component,
  ComponentKey key,
  T Function() create,
) {
  final game = component.findRootGame()!;
  if (game.findByKey(key) != null) {
    return;
  }
  final dispatcher = create();
  game.registerKey(key, dispatcher);
  game.add(dispatcher);
}