required method
Enter a "required" context which requires the picked value to be non-null or a PickException is thrown.
Crashes when the the value is null
.
Implementation
RequiredPick required() {
final value = this.value;
if (value == null) {
final more = fromContext(requiredPickErrorHintKey).value as String?;
final moreSegment = more == null ? '' : ' $more';
throw PickException(
'Expected a non-null value but location $debugParsingExit '
'is ${isAbsent ? 'absent' : 'null'}.$moreSegment',
);
}
return RequiredPick(value, path: path, context: context);
}