KeyEvent class abstract

Defines the interface for keyboard key events.

The KeyEvent provides a universal model for key event information from a hardware keyboard across platforms.

See also:

  • HardwareKeyboard for full introduction to key event model and handling.
  • KeyDownEvent, a subclass for events representing the user pressing a key.
  • KeyRepeatEvent, a subclass for events representing the user holding a key, causing repeated events.
  • KeyUpEvent, a subclass for events representing the user releasing a key.
Mixed in types
Implementers
Annotations

Constructors

KeyEvent({required PhysicalKeyboardKey physicalKey, required LogicalKeyboardKey logicalKey, String? character, required Duration timeStamp, KeyEventDeviceType deviceType = ui.KeyEventDeviceType.keyboard, bool synthesized = false})
Create a const KeyEvent by providing each field.
const

Properties

character String?
Returns the Unicode character (grapheme cluster) completed by this keystroke, if any.
final
deviceType KeyEventDeviceType
The source device type for the key event.
final
hashCode int
The hash code for this object.
no setterinherited
logicalKey LogicalKeyboardKey
Returns an object representing the logical key that was pressed.
final
physicalKey PhysicalKeyboardKey
Returns an object representing the physical location of this key.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
synthesized bool
Whether this event is synthesized by Flutter to synchronize key states.
final
timeStamp Duration
Time of event, relative to an arbitrary start point.
final

Methods

debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited