root property

Returns the root GDisplayObject that is the ancestor of this object (either a Stage or a null).

Implementation

GDisplayObject? get root {
  var current = this;
  while (current.$parent != null) {
    if (current.$parent is Stage) return current;
    current = current.$parent!;
  }
  return null;
}