newLine method

Future<void> newLine()

Writes a line separator.

The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

Example

final writer = FileWriter('output.txt');
try {
  await writer.write('First line');
  await writer.newLine();
  await writer.write('Second line');
  await writer.newLine();
  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<void> newLine() async {
  await writeChar(10); // '\n' - simplified for cross-platform compatibility
}