root property Null safety

DisplayObject root

The top-most display object in the portion of the display list's tree structure.

Implementation

DisplayObject get root {
  var obj = this;
  while (obj.parent != null) {
    obj = obj.parent!;
  }
  return obj;
}