SystemChannels.keyEventexposes a messaging channel that receives raw key data whenever the platform produces keyboard events.
RawKeyboardsubscribes to this channel and forwards incoming messages as
RawKeyEventinstances (which encapsulate
RawKeyEventData). Physical and logical interpretations of the event are exposed via
RawKeyEvent.logicalKey, respectively. The character produced is available as
RawKeyEvent.characterbut only for
RawKeyDownEventevents. This field accounts for modifier keys / past keystrokes producing null for invalid combinations or a dart string, otherwise.
- The physical key identifies the actual position of the key that was struck, expressed as the equivalent key on a standard
QWERTYkeyboard. The logical key ignores position, taking into account any mappings or layout changes to produce the actual key the user intended.
- Subclasses of
RawKeyEventDatainterpret platform-specific data to categorize the keystroke in a portable way (
IMEstands for “input method editor,” which corresponds to any sort of on-screen text editing interface, such as the software keyboard. There can only be one active
IMEat a time.
SystemChannels.textInputexposes a method channel that implements a transactional interface for interacting with an
IME. Operations are scoped to a given transaction (client), which is implicit once created. Outbound methods support configuring the
IME, showing/hiding UI, and update editing state (including selections); inbound methods handle
IMEactions and editing changes. Convenient wrappers for this protocol make much of this seamless.
TextInput.attachfederates access to the
IME, setting the current client (transaction) that can interact with the keyboard.
TextInputClientis an interface to receive information from the
IME. Once attached, clients are notified via method invocation when actions are invoked, the editing value is updated, or the cursor is moved.
TextInputConnectionis returned by
TextInput.attachand allows the
IMEto be altered. In particular, the editing state can be changed, the
IMEshown, and the connection closed. Once closed, if no other client attaches within the current animation frame, the
IMEwill also be hidden.
TextInputConfigurationencapsulates configuration data sent to the
IMEwhen a client attaches. This includes the desired input type (e.g., “datetime”, “
emailAddress”, “phone”) for which to optimize the
IME, whether to enable autocorrect, whether to obscure input, the default action, capitalization mode (
TextCapitalization), and more.
TextInputActionenumerates the set of special actions supported on all platforms (e.g., “
emergencyCall”, “done”, “next”). Actions may only be used on platforms that support them. Actions have no intrinsic meaning; developers determine how to respond to actions themselves.
TextEditingValuerepresents the current text, selection, and composing state (range being edited) for a run of text.
RawFloatingCursorPointrepresents the position of the “floating cursor” on
iOS, a special cursor that appears when the user force presses the keyboard. Its position is reported via the client, including state changes (