Console constructor
Console({})
Creates a new I/O helper.
Implementation
Console({
WriteLine? out,
WriteLine? err,
WriteRaw? outRaw,
WriteRaw? errRaw,
ReadLine? readLine,
SecretReader? secretReader,
io.Stdin? stdin,
io.Stdout? stdout,
this.interactive = true,
this.verbosity = Verbosity.normal,
int? terminalWidth,
Renderer? renderer,
}) : _stdout = stdout ?? io.stdout,
_stdin = stdin ?? io.stdin,
_out = out ?? ((line) => (stdout ?? io.stdout).writeln(line)),
_err = err ?? ((line) => io.stderr.writeln(line)),
_outRaw = outRaw ?? ((text) => (stdout ?? io.stdout).write(text)),
_errRaw = errRaw ?? ((text) => io.stderr.write(text)),
_readLine = readLine ?? (stdin ?? io.stdin).readLineSync,
_secretReader = secretReader,
terminalWidth = terminalWidth ?? 120,
_renderer = renderer ?? defaultRenderer,
_tagParser =
ConsoleTagParser(
colorProfile: (renderer ?? defaultRenderer).colorProfile,
hasDarkBackground:
(renderer ?? defaultRenderer).hasDarkBackground,
)
..registerStyle('info', Style().foreground(Colors.info))
..registerStyle('comment', Style().foreground(Colors.warning))
..registerStyle('question', Style().foreground(Colors.cyan))
..registerStyle('warning', Style().foreground(Colors.warning))
..registerStyle('error', Style().foreground(Colors.error))
..registerStyle('success', Style().foreground(Colors.success))
..registerStyle('muted', Style().foreground(Colors.muted));