hideKeyboard static method

void hideKeyboard()

Hides the software keyboard.

This method unfocused the currently focused input field, if any, to hide the keyboard.

Example:

EaseDevice.hideKeyboard();

Implementation

static void hideKeyboard() {
  final currentFocus = FocusScope.of(Utils.globalKey.currentContext!);
  if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
    FocusManager.instance.primaryFocus?.unfocus();
  }
}