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.

Constructors

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.

Properties

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

Methods

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.
inherited
span(int start, [int? end]) FileSpan
Returns a span from start to end (exclusive).
toString() String
A string representation of this object.
inherited

Operators

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