Processor class

A class that runs shell commands from within a Dart application.

The Processor is used to execute CLI commands such as compiling Dart to JavaScript or running Sass. It prints the command output in color:

  • Green for standard output
  • Blue for warnings
  • Red for errors

Example:

final processor = Processor(
  executable: 'dart',
  arguments: ['compile', 'js', 'bin/main.dart', '-o', 'build/main.js'],
  workingDirectory: 'frontend',
);
await processor.run();

Constructors

Processor({required String executable, required List<String> arguments, required String workingDirectory, required bool warnings, required String name, required Environment environment, required Mode mode, required bool debug})

Properties

arguments List<String>
getter/setter pair
debug bool
getter/setter pair
environment Environment
getter/setter pair
environmentArguments List<String>
getter/setter pair
executable String
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
log ↔ Logger
getter/setter pair
mode Mode
getter/setter pair
name String
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
warnings bool
getter/setter pair
workingDirectory String
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run() → dynamic
Executes the configured command and prints stdout and stderr with colored formatting.
toString() String
A string representation of this object.
inherited

Operators

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