SourceFile class

A class representing a source file.

This doesn't necessarily have to correspond to a file on disk, just a chunk of text usually with a URL associated with it.


SourceFile(String text, { dynamic url })
This constructor is deprecated. [...]
SourceFile.decoded(Iterable<int> decodedChars, { dynamic url })
Creates a new source file from a list of decoded code units. [...]
SourceFile.fromString(String text, { dynamic url })
Creates a new source file from text. [...]


length int
The length of the file in characters.
lines int
The number of lines in the file.
url Uri
The URL where the source file is located. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


getColumn(int offset, { int line }) int
Gets the 0-based column corresponding to offset. [...]
getLine(int offset) int
Gets the 0-based line corresponding to offset.
getOffset(int line, [ int column ]) int
Gets the offset for a line and column. [...]
getText(int start, [ int end ]) String
Returns the text of the file from start to end (exclusive). [...]
location(int offset) FileLocation
Returns a location in this at offset.
span(int start, [ int end ]) FileSpan
Returns a span in this from start to end (exclusive). [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(dynamic other) bool
The equality operator. [...]