booleanWithField<TField extends FormField<bool> > method
void
booleanWithField<TField extends FormField<bool> >({
- required String name,
- bool initialValue = false,
- PropertyValueTraits? valueTraits,
Defines a new property with bool for both of property value type and
form field value type, and preferred form field type TField
.
Note that name
must be unique, and validators are registered as
factories instead of normal closures (function objects) because some
validation framework requires live BuildContext to initialize validator,
and current Locale of the application should be stored to
BuildContext.
TField
affects FormFieldFactory
generation by form_companion_generator
.
Implementation
void booleanWithField<TField extends FormField<bool>>({
required String name,
bool initialValue = false,
PropertyValueTraits? valueTraits,
}) =>
addWithField<bool, bool, TField>(
name: name,
initialValue: initialValue,
valueTraits: valueTraits,
restorableValueFactory: boolRestorableValueFactory,
);