CliOptException constructor

CliOptException([
  1. String name = '',
  2. List? values
])

Exception's constructor: mandatory option name and the list of values if relevant

Implementation

CliOptException([this.name = '', this.values]) {
  var details = '"$name"';

  final length = values?.length ?? 0;

  if (length == 0) {
    this.details = details;
    return;
  }

  details += ': ';

  if (length == 1) {
    details += values![0].toString();
  } else {
    details += values.toString();
  }

  this.details = details;
}