dispatch method

void dispatch(
  1. Event event
)

Implementation

void dispatch(Event event) {
  switch (event.type) {
    case EventType.mouseMovedEvent:
      var mouseMovedEvent = event as MouseMovedEvent;
      var listeners = eventListeners[EventType.mouseMovedEvent]!;
      _dispatchOnListnersList(mouseMovedEvent, listeners);
      break;

    case EventType.mousePressedEvent:
      var mousePressedEvent = event as MousePressedEvent;
      var listeners = eventListeners[EventType.mousePressedEvent]!;
      _dispatchOnListnersList(mousePressedEvent, listeners);
      break;

    case EventType.mouseReleasedEvent:
      var mouseReleasedEvent = event as MouseReleasedEvent;
      var listeners = eventListeners[EventType.mouseReleasedEvent]!;
      _dispatchOnListnersList(mouseReleasedEvent, listeners);
      break;

    case EventType.mouseDraggedEvent:
      var mouseDraggedEvent = event as MouseDraggedEvent;
      var listeners = eventListeners[EventType.mouseDraggedEvent]!;
      _dispatchOnListnersList(mouseDraggedEvent, listeners);
      break;

    case EventType.keyPressedEvent:
      var keyPressedEvent = event as KeyPressedEvent;
      var listeners = eventListeners[EventType.keyPressedEvent]!;
      _dispatchOnListnersList(keyPressedEvent, listeners);
      break;

    case EventType.keyReleasedEvent:
      var keyReleasedEvent = event as KeyReleasedEvent;
      var listeners = eventListeners[EventType.keyReleasedEvent]!;
      _dispatchOnListnersList(keyReleasedEvent, listeners);
      break;
  }
}