isLastChild property

bool isLastChild

returns true iff this node is the last child of the parent or of the parent is null

Implementation

bool get isLastChild {
  if (parent == null) return true;

  return parent!.children.last == this;
}