writeln method

void writeln(
  1. String str
)

Use this to write a string with a trailing newline ('\n'). Whether in mock mode or with real stdout.

Implementation

void writeln(String str) {
  if (mock) {
    _buffer += '$str\n';
    _flush();
  } else {
    stdout.writeln(str);
  }
}