showKeyboard function

void showKeyboard()

Attempts to show the keyboard by requesting focus from the current primary focus node.

This is only useful when a widget has already requested focus and you're trying to force the system to open the keyboard.

Implementation

void showKeyboard() {
  final focus = FocusManager.instance.primaryFocus;
  if (focus != null) {
    focus.requestFocus();
  }
}