StringWriter class final

Wraps a writer and provides an API for writing strings instead of bytes.

This class is useful for writing text to a byte-oriented sink, such as a network socket or file. It encodes strings to bytes using the provided encoding, defaulting to UTF-8.

Constructors

StringWriter(Writer _writer, {Encoding encoding = utf8, String newLine = '\n'})
Creates a new string writer with the provided encoding.

Properties

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

Methods

flush() Future<void>
Flushes the buffer, ensuring all written data is actually written.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
write(String string) → void
Writes the provided string to the sink.
writeAll(Iterable<String> strings, [String separator = '']) → void
Writes the provided strings to the sink.
writeLine([String string = '']) → void
Writes the provided string to the sink, followed by a newline.
writeLines(Iterable<String> strings) → void
Writes the provided strings to the sink, each followed by a newline.

Operators

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