attach method

  1. @override
void attach(
  1. TextInputClient client,
  2. TextInputConfiguration configuration
)
override

Requests the text input control to attach to the given input client.

This method is called when a text input client is attached. The input control should update its configuration to match the client's configuration.

Implementation

@override
void attach(TextInputClient client, TextInputConfiguration configuration) {
  _client = client;
  _configuration = configuration;
  // On while attached, off otherwise: an unfocused catalog pays nothing per
  // key, and a demo's own key handling sees every key whenever no field has
  // focus.
  if (!_listening) {
    _listening = true;
    HardwareKeyboard.instance.addHandler(_handleKey);
  }
}