KeyboardVisibilityProvider class Null safety

Widget that reports to its descendants whether or not the keyboard is currently visible.

Example usage:

// A Builder is used in this example solely for the purpose
// of demonstrating ancestor access from within a single
// build() method. You do not need to use a Builder if you
// access KeyboardVisibilityProvider from within a custom
// StatelessWidget or StatefulWidget.
return KeyboardVisibilityProvider(
  child: Builder(
    builder: (BuildContext context) {
      final bool isKeyboardVisible = KeyboardVisibilityProvider.isKeyboardVisible(context);

      return Text('Keyboard is visible: $isKeyboardVisible');


KeyboardVisibilityProvider({Key? key, required Widget child, KeyboardVisibilityController? controller})


child Widget
controller KeyboardVisibilityController?
Optional: pass in a controller you already have created. This is useful for testing, as you can pass in a mock instance. If no controller is passed in, one will be created automatically.
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() → _KeyboardVisibilityProviderState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel =}) String
A string representation of this object. [...]
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited

Static Methods

isKeyboardVisible(BuildContext context) bool
Returns true if the keyboard is currently visible, false if the keyboard is not currently visible, or null if the flutter_keyboard_visibility plugin does not yet know if the keyboard is visible. [...]