of method Null safety

RenderAbstractViewport? of(
  1. RenderObject? object
)

Returns the RenderAbstractViewport that most tightly encloses the given render object.

If the object does not have a RenderAbstractViewport as an ancestor, this function returns null.

Implementation

static RenderAbstractViewport? of(RenderObject? object) {
  while (object != null) {
    if (object is RenderAbstractViewport) {
      return object;
    }
    object = object.parent as RenderObject?;
  }
  return null;
}