isLastChild property

bool get 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;
}