addEnvironmentVariable method
Adds an environment variable to the current process
Parameters:
key: The name of the environment variablevalue: The value of the environment variable
This method handles platform-specific differences in setting environment variables.
Implementation
void addEnvironmentVariable(String key, String value) {
if (Platform.isWindows) {
_addEnvironmentVariableWindows(key, value);
} else if (Platform.isLinux || Platform.isMacOS) {
_addEnvironmentVariableUnix(key, value);
} else {
throw UnsupportedError(
'Unsupported platform: ${Platform.operatingSystem}',
);
}
}