attemptedCliUpdateVersion function
The version a preceding process already attempted to install, if any.
Returns null when the variable is unset, empty, or not a valid version, which lets the update proceed.
Defaults to the environment of the current process.
Implementation
Version? attemptedCliUpdateVersion([final Map<String, String>? environment]) {
final env = environment ?? Platform.environment;
final value = env[cliUpdateAttemptedEnvName];
if (value == null || value.isEmpty) {
return null;
}
try {
return Version.parse(value);
} on FormatException {
return null;
}
}