writeLine method

void writeLine([
  1. Object? text,
  2. TextAlignment alignment = TextAlignment.left
])

Writes a line to the console, optionally with alignment provided by the TextAlignment enumeration.

If no parameters are supplied, the command simply writes a new line to the console. By default, text is left aligned.

Text alignment operates based off the current window width, and pads the remaining characters with a space character.

Implementation

void writeLine([Object? text, TextAlignment alignment = TextAlignment.left]) {
  final int width = windowWidth;
  if (text != null) {
    writeAligned(text.toString(), width, alignment);
  }
  stdout.writeln();
}