Variables class

A utility class for managing and processing variables with support for environment variables, CLI arguments, and command execution.

This class handles variable substitution in strings using patterns like ${{VAR_NAME}} or ${VAR_NAME} and command execution using patterns like %{{COMMAND}} or %{COMMAND}.

Constructors

Variables(Map<String, dynamic> variables, ArgResults? globalResults)
Creates a new Variables instance with the specified variables and CLI results.
Variables.fromSystem(ArgResults? globalResults)
Creates a Variables instance using system environment variables
factory

Properties

globalResults → ArgResults?
Optional command line arguments results from the global CLI parser
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variables Map<String, dynamic>
A map containing all available variables for substitution
getter/setter pair

Methods

addVariables(Map<String, dynamic> newVariables) → void
Adds new variables to the existing variables map.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
process(String? input) Future<String>
Processes and substitutes variables in a string with their corresponding values.
processMap(Map<String, dynamic> json) Future<Map<String, dynamic>>
Processes all values in a JSON map by substituting variables.
replaceVariables(Map<String, dynamic> newVariables) → void
Replaces the entire variables map with a new one.
substituteCLIArguments(String? input) Future<String>
Substitutes CLI command arguments in a string with their execution results.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

processBySystem(String? input, ArgResults? globalResults) Future<String>
Processes input string using system environment variables.