EventManager constructor

EventManager(
  1. BasicMessageChannel _msgChannel,
  2. {Window? window}
)

Implementation

factory EventManager(
  BasicMessageChannel _msgChannel, {
  Window? window,
}) {
  if (_instances[_msgChannel.name] == null) {
    _instances[_msgChannel.name] = EventManager._(_msgChannel);
  }

  var current = _instances[_msgChannel.name]!;

  // store the window which create the event manager
  if (window != null) {
    if (current._windows[window.id] == null) current._windows[window.id] = [];
    current._windows[window.id]!.add(window);
  }

  // make sure one message channel only one event manager
  return current;
}