Progress class Null safety

central class that provides progress information about a running process.

Constructors

Progress(LineAction stdout, {LineAction stderr = devNull, bool captureStdin = false, bool captureStderr = false})
Creates a Progress that allows you to individually control each aspect of how the Progress prints and captures output to stdout and stderr. It usually easier to use one of the pre-package Progress constructors such as Progress.print.
Progress.capture({bool captureStdout = true, bool captureStderr = true})
Captures the output of the called process to a list which can be obtained by calling Progress.lines once the process completes. By default both stdout and stderr are captured. Set captureStdout to false to suppress capturing of stdout. Set captureStderr to false to suppress capturing of stderr.
Progress.devNull()
Use this progress to have both stdout and stderr output suppressed.
Progress.print({bool capture = false})
Use this progress to print both stdout and stderr. If capture is true (defaults to false) the output to stdout and stderr is also captured and will be available in lines once the process completes.
Progress.printStdErr({bool capture = false})
Use this progress to only output data sent to stderr. If capture is true (defaults to false) the output to stderr is also captured and will be available in lines once the process completes.
Progress.printStdOut({bool capture = false})
Use this progress to only output data sent to stdout. If capture is true (defaults to false) the output to stdout is also captured and will be available in lines once the process completes.
Progress.stream({bool includeStdout = true, bool includeStderr = true})
EXPERIMENTAL [...]

Properties

exitCode int?
The exist code of the completed process.
read / write
firstLine String?
Returns the first line from the command or null if no lines where returned
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
lines List<String>
If the Progress was created with captureStdout = true or captureStderr = true then lines will contain the captured lines. If neither capture is true then lines will return an empty list. [...]
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stream Stream<String>
Returns a combined stream including stdout and stderr. You control whether stderr and/or stdout are inserted into the stream when you call stream(includeStderr: true, includeStdout)
read-only

Methods

addToStderr(String line) → void
adds the line to the stderr controller
addToStdout(String line) → void
adds the line to the stdout controller
close() → void
closes the progress.
forEach(LineAction stdout, {LineAction stderr = devNull}) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onError(RunException error) → void
Sends or enqueues an error event.
toList({int skipLines = 0}) List<String>
Returns stdout and stderr lines as a list. [...]
toParagraph({int skipLines = 0}) String
toParagraph runs the contents of this String as a CLI command and returns the lines written to stdout and stderr as a single String by join the lines with the platform specific line delimiter. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited