LineInfo class

Information about line and column information within a source file.

Constructors

LineInfo(List<int> lineStarts)
Initialize a newly created set of line information to represent the data encoded in the given list of lineStarts.
LineInfo.fromContent(String content)
Initialize a newly created set of line information corresponding to the given file content. Lines end with \r, \n or \r\n.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
lineCount → int
The number of lines.
no setter
lineStarts → List<int>
A list containing the offsets of the first character of each line in the source code.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getLocation(int offset) → CharacterLocation
Return the location information for the character at the given offset.
getOffsetOfLine(int lineNumber) → int
Return the offset of the first character on the line with the given lineNumber.
getOffsetOfLineAfter(int offset) → int
Return the offset of the first character on the line following the line containing the given offset.
lineNumberDifference(int offset1, int offset2) → int
Return the difference in line numbers between offset1 and offset2.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onSameLine(int offset1, int offset2) → bool
Return whether both offset1 and offset2 are on the same line.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

getOffsetForLine(int line, String content) → int?
Get the offset of the 0-indexed line line in content.