character property Null safety

String? character
final

Returns the Unicode character (grapheme cluster) completed by this keystroke, if any.

This will only return a character if this keystroke, combined with any preceding keystroke(s), generats a character, and only on a "key down" event. It will return null if no character has been generated by the keystroke (e.g. a "dead" or "combining" key), or if the corresponding key is a key without a visual representation, such as a modifier key or a control key. It will also return null if this is a "key up" event.

This can return multiple Unicode code points, since some characters (more accurately referred to as grapheme clusters) are made up of more than one code point.

The character doesn't take into account edits by an input method editor (IME), or manage the visibility of the soft keyboard on touch devices. For composing text, use the TextField or CupertinoTextField widgets, since those automatically handle many of the complexities of managing keyboard input.

The character is not available on KeyUpEvents.

Implementation

final String? character;