shell
library
Functions
-
argumentsToString(List<String> arguments)
→ String
-
Convert multiple arguments to string than can be used in a terminal
-
argumentToString(String argument)
→ String
-
Helper to run a process and connect the input/output for verbosity
-
executableArgumentsToString(String? executable, List<String>? arguments)
→ String
-
Convenient way to display a command
-
getFlutterBinChannel()
→ Future<String?>
-
Get flutter channel. (dev, beta, master, stable)
-
getFlutterBinVersion()
→ Future<Version?>
-
Get flutter version.
-
processCmdToDebugString(ProcessCmd cmd)
→ String
-
-
processResultToDebugString(ProcessResult result)
→ String
-
-
prompt(String? text, {Stream<List<int>>? stdin})
→ Future<String>
-
Get text
-
promptConfirm(String? text, {Stream<List<int>>? stdin})
→ Future<bool>
-
Confirm action
-
promptTerminate()
→ Future
-
Terminate a prompt session.
-
run(String script, {bool throwOnError = true, String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, Stream<List<int>>? stdin, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, bool verbose = true, bool? commandVerbose, ShellOptions? options, void onProcess(Process process)?})
→ Future<List<ProcessResult>>
-
Run one or multiple plain text command(s).
-
runExecutableArguments(String executable, List<String> arguments, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding, Stream<List<int>>? stdin, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, bool? verbose, bool? commandVerbose, bool? noStdoutResult, bool? noStderrResult, void onProcess(Process process)?})
→ Future<ProcessResult>
-
if
commandVerbose
or verbose
is true, display the command.
if verbose
is true, stream stdout & stdin
-
runExecutableArgumentsSync(String executable, List<String> arguments, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, bool? verbose, bool? commandVerbose})
→ ProcessResult
-
if
commandVerbose
or verbose
is true, display the command.
if verbose
is true, stream stdout & stdin
-
runSync(String script, {bool throwOnError = true, String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, bool verbose = true, bool? commandVerbose, ShellOptions? options})
→ List<ProcessResult>
-
Run one or multiple plain text command(s).
-
shellArgument(String argument)
→ String
-
Use to safely enclose an argument if needed
-
shellArguments(List<String> arguments)
→ String
-
Convert multiple arguments to string than can be used in a terminal
-
shellExecutableArguments(String executable, List<String> arguments)
→ String
-
Convert executable + arguments to a single script line
-
shellStreamLines(Stream<List<int>> stream, {Encoding? encoding})
→ Stream<String>
-
Basic line streaming. Assuming system encoding
-
stringToArguments(String command)
→ List<String>
-
Convert a string command to arguments.
-
userLoadEnv({Map<String, String>? vars, List<String>? paths, Map<String, String>? aliases})
→ void
-
Only specify the vars to override and the paths to add
-
userLoadEnvFile(String path)
→ void
-
Update userPaths and userEnvironment
-
which(String command, {Map<String, String>? env, Map<String, String>? environment, bool includeParentEnvironment = true})
→ Future<String?>
-
-
whichSync(String command, {Map<String, String>? env, Map<String, String>? environment, bool includeParentEnvironment = true})
→ String?
-
Find the command according to the
paths
or env variables (PATH
)
Exceptions / Errors
-
ShellException
-
Exception thrown in exitCode != 0 and throwOnError is true