flutter_hook_form 2.0.4
flutter_hook_form: ^2.0.4 copied to clipboard
A Flutter package that provides a hook to manage form fields.
2.0.2 #
Improvements #
- ♻️ Update initialization business logic to avoid loosing initial value state on rebuild.
2.0.0 #
Breaking changes #
- 💥
FormProviderhas been renamed toHookedFormProvider - 💥
FormFieldSchemeandHookedFieldIdhave been merged intoHookField - 💥
FormSchemanow declare afieldsproperty to setup form fiels instead of usingsuperconstructor - 💥
buildersyntax has changed onHookedFormFieldallowing to declare anonymous parameters.
Improvements #
- 🐛 Fix
PatternValidatorfor failing on empty strings. Now fails only on non-empty values.
New Features #
- ✨
FormControllercan now be initialized- Generated
FormSchemadeclare a static to initialized eachHookField withInitialValuemethod has been added toHookFieldto initialized a hook field with a given value.
- Generated
1.1.1 #
Improvements #
- ✨ Enhanced
FormFieldsControllerwith improved validation and error handling:- Added optional
notifyandclearErrorsparameters tovalidate()method for more control - Added
setError()method withnotifyparameter to control rebuilds - Introduced
clearForcedErrors()method to manage form errors independently - Added new state tracking properties:
hasBeenInteracted- Detects if any field has been interacted with by userhasChanged- Checks if any field value differs from its initial value
- Added optional
Fix #
- 🐛 Update form generator to correctly identify closing brackets for generic types in annotations.
1.1.0 #
New Features #
-
✨ Introduced
HookedFieldId<F, T>with generic type parameters for improved type safety:- The form schema type
Fis now included in the field ID - This enables better type inference when using form fields
- No need to specify form schema type in most widget usages
- The form schema type
-
🔄 Added reactive form capabilities:
- Form controller now properly notifies listeners when field values change
- Added
registerFieldChangemethod to track field modifications - Added methods to check if fields are dirty:
isDirty,areAnyDirty,areAllDirty
-
✨ Introduced
HookedFormFieldandHookedTextFormField:- Updated to use the new
fieldHookparameter instead offieldKey - Better type inference from field hooks
- Added support for tracking field changes
- Updated to use the new
Improvements #
-
📝 Comprehensive documentation updates:
- Added examples for custom form fields
- Improved explanation of form initialization
- Added section on writing custom form fields
- Updated code examples to use the latest API
-
🐛 Fixed validation issues:
- Resolved bug where forced errors took precedence over validation errors
- Improved error clearing during validation
- Better handling of field rebuilds after validation
Breaking Changes #
- 🔄 Renamed parameter from
fieldKeytofieldHookin form field widgets- Update your code to use
fieldHook: MySchema.fieldinstead offieldKey: MySchema.field - This change better reflects the purpose of the parameter
- Update your code to use
1.0.0 #
Breaking Changes #
-
⚠️ Validator usage has been updated to support internationalization:
- Validators are now declared in a list instead of being chained in a function.
- Validators now return
errorCodeinstead of error messages - Error messages are handled through the
FormErrorMessagesclass - Custom validators need to extend
Validator<T>and provide anerrorCode - See the documentation for migration details
-
✨ Add code generation support for form schemas
-
🌍 Add built-in internationalization support
-
🛠️ Improve code organization and maintainability
0.0.4 #
- Add comprehensive documentation
- Update exports
- Add example for package demonstration
0.0.3 #
- Downgrade mime package to 1.0.6
0.0.2 #
- Add test suite and improve comments
0.0.1 #
- Init project