contains method

bool contains(
  1. GDisplayObject? child, [
  2. bool recursive = true
])

Returns true if a given child is a descendant of this container, or false otherwise.

Implementation

bool contains(GDisplayObject? child, [bool recursive = true]) {
  if (!recursive) {
    return children.contains(child);
  }
  while (child != null) {
    if (child == this) {
      return true;
    }
    child = child.$parent;
  }
  return false;
}