add method
void
add({
- required String text,
- required FlValidator validator,
- required String name,
- bool isLock = false,
Implementation
void add({
required String text,
required FlValidator validator,
required String name,
bool isLock = false,
}) {
final currentForm = value[name];
final form = MapEntry(
name,
switch (currentForm) {
null => FlFormzInput.pure(
name: name,
validation: validator,
value: text,
),
_ => FlFormzInput.dirty(
name: name,
validation: validator,
value: text,
)
},
);
if ((currentForm?.isPure ?? true) && !form.value.isPure && text.isEmpty) {
return;
}
Future(() {
value = {...value, form.key: form.value};
});
}