findCompWhere<C extends Comp<T>> method

C? findCompWhere<C extends Comp<T>>(
  1. bool predicate(
    1. C
    )
)
inherited

Recursively finds the first component of type C satisfying predicate.

Implementation

C? findCompWhere<C extends Comp<T>>(bool Function(C) predicate) {
  for (final comp in getAll<C>()) {
    if (predicate(comp)) return comp;
  }
  for (final comp in _components) {
    final found = comp.findCompWhere<C>(predicate);
    if (found != null) return found;
  }
  return null;
}