Result<T> constructor
- required bool isValid,
- required T value,
- List<
Expectation> ? expectations, - Expectation? expectation,
Implementation
Result({
required this.isValid,
required this.value,
List<Expectation>? expectations,
Expectation? expectation,
}) : assert(
isValid ||
(!isValid && expectation != null ||
(expectations != null && expectations.isNotEmpty)),
'invalid -> provide an expectation or non-empty expectations list',
),
expectations = List.unmodifiable(
expectations ?? (expectation == null ? const <Expectation>[] : [expectation]),
);