env method

String env(
  1. String name, [
  2. bool force = true
])

Implementation

String env(String name, [bool force = true]) {
  if (Platform.environment[name] == null) {
    if (force) {
      logger.log('$name 环境变量未配置', status: LogStatus.error);
      exit(1);
    } else {
      return '';
    }
  }
  return Platform.environment[name]!;
}