isChildOf<T extends Parentable<T>> function

bool isChildOf<T extends Parentable<T>>(
  1. T child,
  2. Iterable<T> parents
)

Implementation

bool isChildOf<T extends Parentable<T>>(T child, Iterable<T> parents) {
  for (T? parent = child; parent != null; parent = parent.parent) {
    if (parents.contains(parent)) {
      return true;
    }
  }
  return false;
}