SourceOffsetIndex class

Converts offsets between Dart strings and the UTF-8 source used by parsers.

An offset inside a surrogate pair or a multibyte UTF-8 sequence resolves to the beginning of that scalar. Unpaired surrogates occupy three UTF-8 bytes, matching the replacement character emitted by Dart's UTF-8 encoder.

Constructors

SourceOffsetIndex(String source)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
utf16Length int
final
utf8Length int
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
utf16OffsetForUtf8Offset(int offset) int
Converts a byte offset, rounding inside a scalar toward its start.
utf8OffsetForUtf16Offset(int offset) int
Converts a UTF-16 offset, clamping out-of-range values to source bounds.

Operators

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