KeyEvent class Null safety

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, 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
hashCode int
The hash code for this object.
read-only, inherited
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.
read-only, inherited
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 non-existent 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