isClosed static method

bool isClosed(
  1. BuildContext context
)

Whether the keyboard is currently open. Requires a Keyboard ancestor. Example usage:

bool isClosed = Keyboard.isClosed(context);

Implementation

static bool isClosed(BuildContext context) {
  //
  final scope = context.dependOnInheritedWidgetOfExactType<_KeyboardScope>();
  assert(
    scope != null,
    'Keyboard.isClosed() called without a Keyboard ancestor. '
    'Wrap the app (above any Scaffold) in a Keyboard widget.',
  );
  return !scope!.isOpen;
}