getAncestor<T> method

T? getAncestor<T>()

Implementation

T? getAncestor<T>() {
  Node? node = this;
  while (node != null) {
    if (node is T) {
      return node as T;
    }
    node = node.getParent();
  }
  return null;
}