v0.5.0-dev.1
Pre-release
Pre-release
0.5.0-dev.1
-
docs: use nullable validator in
README
-
feat: add example Flutter app
-
BREAKING: decouple purity, validity, and submission status
Changes
FormzStatus
renamed toFormzSubmissionStatus
:
/// Enum representing the submission status of a form. enum FormzSubmissionStatus { /// The form is in the process of being submitted. inProgress, /// The form has been submitted successfully. success, /// The form submission failed. failure, /// The form submission has been canceled. canceled }
FormzInput
class no longer exposes astatus
(FormzInputStatus
). Instead there areisValid
andisNotValid
getters:
class NameInput extends FormzInput<String, NameInputError> { const NameInput.pure() : super.pure(''); const NameInput.dirty({String value = ''}) : super.dirty(value); @override NameInputError? validator(String value) { return value.isNotEmpty == true ? null : NameInputError.empty; } } void main() { const name = NameInput.pure(); print(name.isValid); // false print(name.isNotValid); // true const joe = NameInput.dirty(value: 'joe'); print(joe.isValid); // true print(joe.isNotValid); // false }
FormzInput
has adisplayError
getter which returns an error to display if the input is not valid and has been modified by the user (closes #44)
void main() { const name = NameInput.pure(); print(name.displayError); // null const invalid = NameInput.dirty(value: ''); print(name.displayError); // NameInputError.empty }
- Renamed
pure
toisPure
for consistency