StringReader class
A Reader implementation that reads characters from a String buffer.
This reader allows sequential, asynchronous reading of characters or character blocks from an in-memory string.
Common use case:
final reader = StringReader('hello');
final buffer = List<int>.filled(5, 0);
final read = await reader.read(buffer); // buffer now contains [104, 101, 108, 108, 111]
await reader.close();
The reader supports mark/reset operations for backtracking.
Constructors
- StringReader(String _buffer)
- A Reader implementation that reads characters from a String buffer.
Properties
Methods
-
checkClosed(
) → void -
Checks if the reader is closed and throws an exception if it is.
inherited
-
close(
) → Future< void> -
Closes the stream and releases any system resources associated with it.
override
-
mark(
int readAheadLimit) → void -
Marks the present position in the stream.
override
-
markSupported(
) → bool -
Tells whether this stream supports the mark() operation.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
List< int> cbuf, [int offset = 0, int? length]) → Future<int> -
Reads characters into an array.
override
-
readAll(
) → Future< String> -
Reads all remaining characters from the reader.
inherited
-
readChar(
) → Future< int> -
Reads a single character.
override
-
readLine(
) → Future< String?> -
Reads a line of text.
inherited
-
ready(
) → Future< bool> -
Tells whether this stream is ready to be read.
override
-
reset(
) → Future< void> -
Resets the stream.
override
-
skip(
int n) → Future< int> -
Skips characters.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited