findComp<C extends Comp<T>> method

C? findComp<C extends Comp<T>>()

Recursively finds the first component of type C in this subtree.

Implementation

C? findComp<C extends Comp<T>>() {
  final topLevel = get<C>();
  if (topLevel != null) return topLevel;

  for (final comp in _components) {
    final subComp = comp.findComp<C>();
    if (subComp != null) return subComp;
  }

  return null;
}