FoldRange class

Represents a foldable code region in the editor.

A fold range defines a region of code that can be collapsed (folded) to hide its contents. This is typically used for code blocks like functions, classes, or control structures.

Fold ranges are automatically detected based on code structure (braces, indentation) when folding is enabled in the editor.

Example:

// A fold range from line 5 to line 10
final foldRange = FoldRange(5, 10);
foldRange.isFolded = true; // Collapse the region

Constructors

FoldRange(int startIndex, int endIndex)
Creates a FoldRange with the specified start and end line indices.

Properties

endIndex int
The ending line index (zero-based) of the fold range.
final
hashCode int
The hash code for this object.
no setteroverride
isFolded bool
Whether this fold range is currently collapsed.
getter/setter pair
originallyFoldedChildren List<FoldRange>
Child fold ranges that were originally folded when this range was unfolded.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startIndex int
The starting line index (zero-based) of the fold range.
final

Methods

addOriginallyFoldedChild(FoldRange child) → void
Adds a child fold range that was originally folded.
clearOriginallyFoldedChildren() → void
Clears the list of originally folded children.
containsLine(int line) bool
Checks if a line is contained within this fold range.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override