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
Implemented types


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


classRef ClassRef?
If an object is allocated in the Dart heap, it will have a corresponding class object.
read / writeinherited
columnOffset int?
read / write
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.
read / writeinherited
hashCode int
The hash code for this object.
id String?
A unique identifier for an Object. Passed to the getObject RPC to reload this Object.
read / writeinherited
json Map<String, dynamic>?
read / writeinherited
library LibraryRef?
The library which owns this script.
read / write
lineOffset int?
read / write
runtimeType Type
A representation of the runtime type of the object.
size int?
The size of this object in the heap.
read / writeinherited
source String?
The source code for this script. This can be null for certain built-in scripts.
read / write
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.
read / write
type String
uri String?
The uri from which this script was loaded.
read / writeoverride


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.
toJson() Map<String, dynamic>
toString() String
A string representation of this object.


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

Static Methods

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