Result<T>.invalid constructor

Result<T>.invalid(
  1. T value, {
  2. List<Expectation>? expectations,
  3. Expectation? expectation,
})

Implementation

Result.invalid(this.value, {List<Expectation>? expectations, Expectation? expectation})
    : assert(
        (expectation != null || (expectations != null && expectations.isNotEmpty)),
        "If invalid, either 'expectation' or a non-empty 'expectations' list must be provided",
      ),
      isValid = false,
      expectations = (expectations != null
          ? List.unmodifiable(expectations)
          : List.unmodifiable([expectation!]));