writeln method

  1. @override
Future<void> writeln([
  1. Object? obj = "",
  2. String linebreak = "\n"
])
override

Writes the string representation of object followed by a newline.

Equivalent to buffer.write(object) followed by buffer.write("\n").

Notice that calling buffer.writeln(null) will write the "null" string before the newline. Omitting the argument, or explicitly passing an empty string, is the recommended way to emit just the newline.

Implementation

@override
Future<void> writeln([Object? obj = "", String linebreak = "\n"]) {
  if (linebreak.isNotEmpty) {
    return write(obj).then((_) => write(linebreak));
  } else {
    return write(obj);
  }
}