appendString method

Future<Writer> appendString(
  1. String? csq
)

Appends the specified character sequence to this writer.

Parameters

  • csq: The character sequence to append (if null, writes "null")

Returns

This writer

Example

final writer = FileWriter('output.txt');
try {
  await writer.appendString('Hello')
             .appendString(', ')
             .appendString('World!');
  await writer.flush();
} finally {
  await writer.close();
}

Throws IOException if an I/O error occurs. Throws StreamClosedException if the writer has been closed.

Implementation

Future<Writer> appendString(String? csq) async {
  await write(csq ?? 'null');
  return this;
}