fix(form): add nullable validator on boolean value

This commit is contained in:
Hugo Pointcheval 2022-11-15 18:09:39 -05:00
parent 141f15b444
commit 9ebe8e21dc
Signed by: hugo
GPG Key ID: A9E8E9615379254F
2 changed files with 3 additions and 4 deletions

View File

@ -22,11 +22,11 @@ import 'package:wyatt_form_bloc/src/domain/input_validators/form_input_validator
/// {@endtemplate}
class Boolean extends NullableValidator<bool, ValidationStandardError> {
/// {@macro boolean}
const Boolean.pure({bool? defaultValue = false})
: super.pure(defaultValue ?? false);
const Boolean.pure({bool defaultValue = false})
: super.pure(defaultValue);
/// {@macro boolean}
const Boolean.dirty({bool value = false}) : super.dirty(value);
const Boolean.dirty({bool? value}) : super.dirty(value);
@override
ValidationStandardError get onNull => ValidationStandardError.invalid;

View File

@ -35,7 +35,6 @@ class FormInput<
FormInput(
this.key,
this.validator, {
// ignore: avoid_redundant_argument_values
FormInputMetadata<Extra>? metadata,
}) {
this.metadata = metadata ?? FormInputMetadata<Extra>();