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({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.
optional">@optionalread / writeinherited
columnOffset int?
optional">@optionalread / 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">@optionalread / writeinherited
hashCode int
The hash code for this object.
read-onlyoverride
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?
optional">@optionalread / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
size int?
The size of this object in the heap.
optional">@optionalread / writeinherited
source String?
The source code for this script. This can be null for certain built-in scripts.
optional">@optionalread / 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">@optionalread / write
type String
read-onlyoverride
uri String?
The uri from which this script was loaded.
read / writeoverride

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