Console constructor

Console({
  1. WriteLine? out,
  2. WriteLine? err,
  3. WriteRaw? outRaw,
  4. WriteRaw? errRaw,
  5. ReadLine? readLine,
  6. SecretReader? secretReader,
  7. Stdin? stdin,
  8. Stdout? stdout,
  9. bool interactive = true,
  10. Verbosity verbosity = Verbosity.normal,
  11. int? terminalWidth,
  12. Renderer? renderer,
})

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));