Script class

A Script provides information about a Dart language script.

The tokenPosTable is an array of int arrays. Each subarray consists of a line number followed by (tokenPos, columnNumber) pairs:

[lineNumber, (tokenPos, columnNumber)*]

The tokenPos is an arbitrary integer value that is used to represent a location in the source code. A tokenPos value is not meaningful in itself and code should not rely on the exact values returned.

For example, a tokenPosTable with the value...

[[1, 100, 5, 101, 8],[2, 102, 7]]

...encodes the mapping:

tokenPos line column
100 1 5
101 1 8
102 2 7
Inheritance
Implemented types

Constructors

Script({String? uri, LibraryRef? library, required String id, int? lineOffset, int? columnOffset, String? source, List<List<int>>? tokenPosTable})

Properties

classRef ClassRef?
If an object is allocated in the Dart heap, it will have a corresponding class object.
getter/setter pairinherited
columnOffset int?
getter/setter pair
fixedId bool?
Provided and set to true if the id of an Object is fixed. If true, the id of an Object is guaranteed not to change or expire. The object may, however, still be Collected.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setteroverride
id String?
A unique identifier for an Object. Passed to the getObject RPC to reload this Object.
getter/setter pairinherited
json Map<String, dynamic>?
getter/setter pairinherited
library LibraryRef?
The library which owns this script.
getter/setter pair
lineOffset int?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int?
The size of this object in the heap.
getter/setter pairinherited
source String?
The source code for this script. This can be null for certain built-in scripts.
getter/setter pair
tokenPosTable List<List<int>>?
A table encoding a mapping from token position to line and column. This field is null if sources aren't available.
getter/setter pair
type String
no setteroverride
uri String?
The uri from which this script was loaded.
getter/setter pairoverride

Methods

getColumnNumberFromTokenPos(int tokenPos) int?
This function maps a token position to a column number. The VM considers the first column to be column 1.
getLineNumberFromTokenPos(int tokenPos) int?
This function maps a token position to a line number. The VM considers the first line to be line 1.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
override
toString() String
A string representation of this object.
override

Operators

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

Static Methods

parse(Map<String, dynamic>? json) Script?
override