dismiss method

void dismiss()

What a platform does when the user closes the IME without touching the app — the swipe-down on Android, the dismiss key on an iPad, and the one gesture that takes a keyboard away from outside the app.

It makes the app react rather than making artwork disappear: TextInputClient.connectionClosed is what EditableText unfocuses on, so the field lets go and the keyboard comes down because the view dismissed it, which is the rule the whole feature is built on.

The trap it exists to avoid. On this path TextInput._clearClient() never runs, so no detach ever arrives: a control that waited for one would keep its key handler installed and its client believed-focused, and the next keystroke would go to a field that has already let go. So the teardown happens here, before the client is told.

Implementation

void dismiss() {
  var client = _client;
  if (client == null) return;
  _release();
  client.connectionClosed();
  asking.value = null;
}