ParseResult<T>.fromNullable constructor
ParseResult<T>.fromNullable (
- T? parsed, {
- required String errorMessage,
Implementation
factory ParseResult.fromNullable(
T? parsed, {
required String errorMessage,
}) {
if (parsed == null) {
return ParseFailure(
errors: [errorMessage],
);
} else {
return ParseSuccess(
result: parsed,
);
}
}