SourceFile class Null safety

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.


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


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 at offset.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
span(int start, [int? end]) FileSpan
Returns a span from start to end (exclusive).
toString() String
A string representation of this object.


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