value property Null safety

String? value

Will throw an ArgumentError if the input is required and the value is null or if the value is an empty string and canBeEmpty is false.

Implementation

String? get value {
  final key = 'INPUT_${name.toUpperCase().replaceAll(" ", "_")}';
  final value = Platform.environment[key];
  if ((value == null && isRequired) ||
      (value != null && value.isEmpty && !canBeEmpty)) {
    throw ArgumentError('No value was given for the argument \'$name\'.');
  }
  return value;
}