Script class Null safety

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:

tokenPoslinecolumn
10015
10118
10227
Inheritance
Implemented types

Constructors

Script({required String? uri, required 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. [...]
@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
read-only, override
uri String?
The uri from which this script was loaded.
read / write, override

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 non-existent 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