findFocusedLeaf method

FocusNode? findFocusedLeaf()

Traverses down the focused path to find the deeply focused leaf node.

Implementation

FocusNode? findFocusedLeaf() {
  if (this == FocusManager.instance.primaryFocus) return this;
  if (!_isFocused) return null;
  for (final child in children) {
    if (child._isFocused) {
      return child.findFocusedLeaf();
    }
  }
  return this;
}