Prevent additional checks from failing if nullable value is null

This commit is contained in:
David 2022-08-15 13:20:38 +10:00 committed by GitHub
parent d9f342a180
commit 9bb85dfe46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -190,10 +190,11 @@ class GeneratedColumn<T extends Object> extends Column<T> {
final nullOk = $nullable;
if (!nullOk && value == null) {
return _invalidNull;
} else if (nullOk && value == null) {
return const VerificationResult.success();
} else {
// ignore: null_check_on_nullable_type_parameter
return additionalChecks?.call(value!, meta) ??
const VerificationResult.success();
// ignore: null_check_on_nullable_type_parameter
return additionalChecks?.call(value!, meta) ?? const VerificationResult.success();
}
}