findState<S extends State<StatefulWidget>> method

S? findState<S extends State<StatefulWidget>>()

Finds a State of type S inside this widget's element tree.

Implementation

S? findState<S extends State>() {
  if (_element == null) return null;
  return _findStateRecursive<S>(_element!);
}