StringView class Null safety

A wrapper class to facilitate operations on a String.

A pointer is used to indicate the index at which this view is currently operating at. All operations on this view leave an entry in its history, and can be undone using undo.

Constructors

StringView(String buffer)
Construct a new StringView on buffer.

Properties

buffer String
The String this view represents.
final
current String
The character at the current index in buffer.
read-only
end int
The size of this views buffer length.
read-only
eof bool
Whether this view is at EOF, i.e if the current pointer has reached the end of the buffer.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
history List<int>
A list of indices this view was at before operations, ordered from least recent first to most recent last.
read / write
index int
The current index of this views pointer.
read / write
isWhitespace bool
Whether the current character is whitespace. [...]
read-only
remaining String
The remaining data in buffer after the current index.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copy() StringView
Create a copy of this StringView with a matching buffer, index and history.
escape(int start, int end) String
Escape characters in buffer from start to end.
getQuotedWord() String
Get the next quoted word after the pointer. [...]
getWord() String
Get the next word after the pointer. [...]
isEscaped(int index) bool
Returns true if the character at index is escaped and false otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
skipString(String s) bool
Check if the data after the pointer matches s, and move the pointer beyond it if it does. Retuns true if the string matches s and false otherwise.
skipWhitespace() → void
Moves the pointer past any whitespace until the next non-whitespace character or EOF is found.
toString() String
A string representation of this object. [...]
override
undo() → void
Undo the last operation on this view. [...]

Operators

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