StringWriter constructor

StringWriter(
  1. Writer _writer,
  2. {Encoding encoding = utf8,
  3. String newLine = '\n'}
)

Creates a new string writer with the provided encoding.

The encoding is used to convert strings to bytes before writing them to the underlying writer. The default encoding is UTF-8, but may be changed to any other supported encoding.

Implementation

StringWriter(
  this._writer, {
  Encoding encoding = utf8,
  String newLine = '\n',
})  : _encoding = encoding,
      _newLine = newLine;