MountPreconditionRow constructor

MountPreconditionRow({
  1. required MountPrecondition precondition,
  2. required MountOutcome outcome,
  3. required String detail,
  4. String remedy = '',
  5. List<String> evidence = const <String>[],
  6. String retrievedBy = '',
})

Creates one answered precondition.

evidence is the trimmable material — ids, keys, per-path counts — that backs detail. retrievedBy is the exact scoped read that returns it in full, and is required whenever there is evidence to lose.

Implementation

MountPreconditionRow({
  required this.precondition,
  required this.outcome,
  required this.detail,
  this.remedy = '',
  this.evidence = const <String>[],
  this.retrievedBy = '',
}) {
  if (detail.trim().isEmpty) {
    throw ArgumentError.value(
      detail,
      'detail',
      'every ${precondition.wire} row states its evidence; a blank detail is '
          'a row that says nothing',
    );
  }
  if (outcome != MountOutcome.pass && remedy.trim().isEmpty) {
    throw ArgumentError.value(
      remedy,
      'remedy',
      'a ${outcome.wire} ${precondition.wire} row without a remedy leaves '
          "the dance in the operator's head",
    );
  }
  if (outcome == MountOutcome.pass && remedy.trim().isNotEmpty) {
    throw ArgumentError.value(
      remedy,
      'remedy',
      'a PASS ${precondition.wire} row has nothing to remedy',
    );
  }
  if (evidence.isNotEmpty && retrievedBy.trim().isEmpty) {
    throw ArgumentError.value(
      retrievedBy,
      'retrievedBy',
      'evidence that can be withheld names the read that retrieves it',
    );
  }
}