KeyEvent(String type, { Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0, int charCode: 0, int keyLocation: 1, bool ctrlKey: false, bool altKey: false, bool shiftKey: false, bool metaKey: false, EventTarget currentTarget })

Programmatically create a new KeyEvent (and KeyboardEvent).

Source

factory KeyEvent(String type,
    {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0,
    int charCode: 0, int keyLocation: 1, bool ctrlKey: false,
    bool altKey: false, bool shiftKey: false, bool metaKey: false,
     EventTarget currentTarget}) {
   var parent = new KeyboardEvent(type, view: view, canBubble: canBubble,
      cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey,
      altKey: altKey, shiftKey: shiftKey, metaKey: metaKey);
   var keyEvent = new KeyEvent.wrap(parent);
   keyEvent._shadowAltKey = altKey;
   keyEvent._shadowCharCode = charCode;
   keyEvent._shadowKeyCode = keyCode;
   keyEvent._currentTarget = currentTarget == null ? window : currentTarget;
   return keyEvent;
 }