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:


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...


...encodes the mapping:

Implemented types


Script({@required String uri, @required 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. [...]
@optional, read / write, inherited
columnOffset int
@optional, 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.
@optional, read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, override
id String
A unique identifier for an Object. Passed to the getObject RPC to reload this Object. [...]
read / write, inherited
json Map<String, dynamic>
read / write, inherited
library LibraryRef
The library which owns this script.
read / write
lineOffset int
@optional, read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size int
The size of this object in the heap. [...]
@optional, read / write, inherited
source String
The source code for this script. This can be null for certain built-in scripts.
@optional, 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.
@optional, read / write
type String
Every response returned by the VM Service has the type property. This allows the client distinguish between different kinds of responses.
read / write, inherited
uri String
The uri from which this script was loaded.
read / write, override


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 non-existent method or property is accessed. [...]
toJson() Map<String, dynamic>
toString() String
A string representation of this object. [...]


operator ==(dynamic other) bool
The equality operator. [...]

Static Methods

parse(Map<String, dynamic> json) Script