FileSpan class abstract

A SourceSpan within a SourceFile.

Unlike the base SourceSpan, FileSpan lazily computes its line and column values based on its offset and the contents of file. SourceSpan.message is also able to provide more context then SourceSpan.message, and SourceSpan.union will return a FileSpan if possible.

A FileSpan can be created using SourceFile.span.

Implemented types
Available extensions

Constructors

FileSpan()

Properties

context String
Text around the span, which includes the line containing this span.
no setterinherited
end FileLocation
The end location of this span, exclusive.
no setteroverride
file SourceFile
The file that this belongs to.
no setter
hashCode int
The hash code for this object.
no setterinherited
length int
The length of this span, in characters.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceUrl Uri?
The URL of the source (typically a file) of this span.
no setterinherited
start FileLocation
The start location of this span.
no setteroverride
text String
The source text for this span.
finalinherited

Methods

compareTo(SourceSpan other) int
Compares two spans.
inherited
expand(FileSpan other) FileSpan
Returns a new span that covers both this and other.
highlight({Object? color}) String
Prints the text associated with this span in a user-friendly way.
inherited
highlightMultiple(String label, Map<SourceSpan, String> secondarySpans, {bool color = false, String? primaryColor, String? secondaryColor}) String

Available on SourceSpan, provided by the SourceSpanExtension extension

Like SourceSpan.highlight, but also highlights secondarySpans to provide the user with additional context.
message(String message, {Object? color}) String
Formats message in a human-friendly way associated with this span.
inherited
messageMultiple(String message, String label, Map<SourceSpan, String> secondarySpans, {bool color = false, String? primaryColor, String? secondaryColor}) String

Available on SourceSpan, provided by the SourceSpanExtension extension

Like SourceSpan.message, but also highlights secondarySpans to provide the user with additional context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subspan(int start, [int? end]) FileSpan

Available on FileSpan, provided by the FileSpanExtension extension

See SourceSpanExtension.subspan.
subspan(int start, [int? end]) SourceSpan

Available on SourceSpan, provided by the SourceSpanExtension extension

Returns a span from start code units (inclusive) to end code units (exclusive) after the beginning of this span.
subspan(int start, [int? end]) SourceSpanWithContext

Available on SourceSpanWithContext, provided by the SourceSpanWithContextExtension extension

Returns a span from start code units (inclusive) to end code units (exclusive) after the beginning of this span.
toString() String
A string representation of this object.
inherited
union(SourceSpan other) SourceSpan
Creates a new span that's the union of this and other.
inherited

Operators

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