bond_form 0.0.21
bond_form: ^0.0.21 copied to clipboard
Form is a Bond package provides a convenient way to handle Form.
Changelog #
0.0.21 #
- Fix
setErrormethod fromBaseFormController.
0.0.20 #
- Fix
updateValueerror logic method fromBaseFormController.
0.0.19 #
- Remove forced
touchedupdate in form field value changes
0.0.18 #
- Fix
updateValueerror logic method fromBaseFormController.
0.0.17 #
- Fix
updateValuemethod fromBaseFormController.
0.0.16 #
- Sync text controller on state updates for
TextFieldState.
0.0.15 #
- Refine form field update and validation logic.
0.0.14 #
- Added new
BetweenValuerule to validate if a field value is between two specified values. - Updated
MaxValueandMinValuerules to supportStringtypes.
0.0.13 #
- Added type safety validation in field listeners
- Enhanced error messages for type mismatches
- Added runtime type checking for field values and listeners
- Improved debugging capabilities for field type mismatches
0.0.12 #
- Improved type safety in field listeners
- Enhanced field value type checking in notifyFieldListeners
- Updated removeFieldListener to support generic types
0.0.11 #
- Refactored field tracking logic into separate
FieldChangeTrackingMixin - Enhanced form state management with improved field tracking
- Added
resetInitialFieldsValuemethod to reset tracking state - Added field change tracking with
hasFieldChangedmethod - Improved handling of field value listeners
- Added clear method override to reset initial field values
0.0.10+6 #
- Updated
intldependency to^0.20.2to ensure compatibility with the latest Flutter versions.
0.0.10+5 #
- Added
resolveAsyncField<T>(fieldName)method onBaseFormControllerto resolve and updateAsyncHiddenFieldState<T>values. - Returned
Future<T>allows awaiting the resolved value in the UI or controller logic. - Automatically updates field value and clears error on success; captures and logs error on failure.
- Marked
pendingValueinAsyncHiddenFieldState<T>as@internalto enforce controlled access and avoid misuse.
0.0.10+4 #
- Added
updateAsyncHiddenField,asyncHiddenField,asyncHiddenFieldValueand requiredasyncHiddenFieldValuemethods toXFormControllerandXBondFormStateextensions respectively to support async hidden fields.
0.0.10+3 #
- Added
AsyncHiddenFieldStateto support hidden form fields with asynchronously loaded values
0.0.10+2 #
- Fixed: Avoided redundant API calls on screen pop by using state.
fieldsinstead offields()inside thedispose()method.
0.0.10+1 #
- Fix
bodymethod to not ignore zero values even whenignoreEmptyValuesset to true.
0.0.10 #
- Added support for
ignoredBodyKeysto allow excluding specific fields from the request body. - Added
ignoreEmptyValuesflag to automatically skip null, empty String, or zero int values in the final body. - Added
remapKeysto allow field name remapping in the output body (e.g., 'paymentMethod' → 'paymentDetails'). - Added
mergeNestedMapsto flatten nestedMap<String, dynamic>into the root body when needed. - Added
postProcessBody(Map<String, dynamic>)for custom final cleanup of the body map before sending. - Supported nullable transformation in
registerForFieldto allow clean handling of optional or missing values in field transformations.
0.0.9+8 #
- Fix
updateErrormethod.
0.0.9+7 #
- Remove
clearField()and enhancedupdateValue()to support null values usingcopyWithNullable, simplifying API and ensuring consistent handling across field types.
0.0.9+6 #
- Implement
clearField(String field)method to help set null values for fields.
0.0.9+5 #
- Fix
updateRadioGroupItemsmethod.
0.0.9+4 #
- Fix
updateRadioGroupItemsmethod.
0.0.9+3 #
- Added
updateRadioGroupItemsmethod toXFormControllerextension inform_controller_extension.dartto allow updating aRadioGroupFieldStatewith a list ofRadioButtonFieldStateitems.
0.0.9+2 #
- Introduce
AsyncRadioGroupFieldStateto support asynchronous fetching of radio button group items.
0.0.9+1 #
- Improved form controller resource cleanup by ensuring text field listeners are removed for all TextFieldState fields in FormController.dispose().
0.0.9 #
- Added Disposable mixin to support proper resource cleanup for form states.
0.0.8+1 #
- Fix a bug
BaseFormControlleron failure and the error type was not from the provided type.
0.0.8 #
Added #
- Support for field key–specific transformations in
TransformersRegistry. - New method
registerForFieldto register transformers tied to a specific field name.
Changed #
BodyConvertiblenow passes thefieldKeyto the transformer for prioritized key-based transformation.
Example #
You can now add country code like this:
registry.registerForField<String, String>('phoneNumber', (value) => '+974$value');
0.0.7+1 #
Fixes #
-
Fixed a timing issue where
onSuccessandonFailurecould conflict with internalstateupdates. -
onSuccess/onFailureare now executed inside aFuture.microtask(...)to ensure state changes (likestatus,success, orfailure) are fully applied before triggering user-defined logic. -
This improves UI consistency and prevents rare bugs where
setError()orupdateField()had no visible effect when called immediately after submission failure. -
0.0.7 #
✨ Features #
- Lifecycle Hooks for Submission
- Added
onSuccess(Success result)toBaseFormController: triggered when form submission is successful. - Added
onFailure(Failure error)toBaseFormController: triggered when submission fails or throws. - These methods can now be optionally overridden inside your controller class.
- Eliminates the need for manually listening to form state externally.
- Added
🧠 Developer Experience #
- Improves readability and centralizes post-submit logic inside the controller.
- Especially helpful for frameworks like GetX where external listeners (e.g.,
ever) were previously needed.
✅ Example: #
@override
void onSuccess(MyResponse res) => Get.toNamed('/home');
@override
void onFailure(ServerError err) => Get.snackbar('Error', err.message);
0.0.6+4 #
- fix
BodyConvertibleerrorgenerics type to be extends anyError.
0.0.6+3 #
- fix
TextFieldStatenthat's clear_controlleroncopyWithmethod whenvalueis null.
0.0.6+2 #
- export missing
form_controller_text_field_extensionextension.
0.0.6+1 #
- Introduced a private
_controllerto avoid direct external access to the controller. - Developers are now encouraged to access the controller only via the
textFieldController()method on the controller. A - Added
disposeTextFieldListener(fieldName)to remove listeners manually.
0.0.6 #
- Add
TextEditingControllertoTextFieldState.
0.0.5 #
Breaking Changes #
- Renamed
updatemethod toupdateFieldinGetxFormControllerto avoid conflict withGetxController. - This change requires updating all instances where the
updatemethod was used toupdateField.
0.0.4+1 #
- Downgraded
intlfrom^0.20.2to^0.19.0to fix compatibility issues with Flutter.
0.0.4 #
Changed #
- meta: Upgraded from
^1.8.0to^1.15.0. - mime: Upgraded from
^1.0.5to^2.0.0. - intl: Upgraded from
^0.19.0to^0.20.2. - bond_core: Upgraded from
^0.0.2to^0.0.3.
0.0.3+1 #
- Introduced BaseFormController mixin to handle common form state logic and provide reusable form management functions.
0.0.3+1 #
- add missing method
optionalonrules.dartfile
0.0.3 #
Added #
- Optional Rule: Introduced the
Optionalvalidation rule that allows fields to be marked as optional. If the field is not present (null, empty string, or empty list), validation will pass, and all other rules will be skipped. If the field is present, other rules will be validated against the value. - Enhanced Validation Logic: The
validatemethod inFormFieldStatenow properly handles theOptionalrule, ensuring that optional fields can skip validation when appropriate.
Changed #
- General Validation Logic: Updated the general validation logic to support the new
Optionalrule, improving flexibility and making form validation more intuitive for optional fields.
Fixed #
- Bug Fixes: Resolved issues related to handling
nulland empty values in form validation, ensuring that the newOptionalrule operates smoothly within the validation pipeline.
0.0.2 #
-
Automatic Body Generation with BodyConvertible Mixin • Introduced the BodyConvertible mixin, which allows automatic generation of a request body map from form state values. This simplifies the process of extracting and transforming form field values into a key-value map suitable for API requests. • The body() method automatically iterates over all form fields, applying registered transformers to generate the body map.
-
Flexible Field Transformers with TransformersRegistry • Added the TransformersRegistry class, which allows developers to register custom field transformers. These transformers can convert field values into any desired format, such as converting enum values to strings. • The registry supports both single values and collections (e.g., Set, List), automatically handling the transformation of collection elements.
0.0.1+30 #
- update dependence
0.0.1+29 #
- add
setErrormethod toFormControllermixin to set the error message of a specific field. - add
updateErrormethod toFormControllermixin to update the error message of a specific field. - The
setErrormethod directly sets a provided error message for a field, while theupdateErrormethod appends the provided error message to any existing validation errors for the field.
0.0.1+28 #
- Fix isTrue & isFalse rules to deal with null value and now support bool, String & num types.
0.0.1+27 #
- Added date field support to form extensions.
BondFormStateupdated with methods to handle date fields.dateFieldValue: Retrieves the value of a date field.dateField: Retrieves the state of a date field using a simplifiedgetmethod.
0.0.1+26 #
- Added
FileFieldStateclass to manage the state of file form fields.FileFieldStateprovides a way to manage file input fields within a form.
0.0.1+25 #
- Refactor: Separated field state and value retrieval methods into distinct files.
- Moved field state retrieval methods to
bond_form_extensions.dart. - Moved value retrieval methods to
bond_form_values.dart.
- Moved field state retrieval methods to
- Enhancement: Updated
required_values.dartto include theRequiredValuesclass for mandatory field checks. - Improvement: Improved overall code organization and maintainability by dividing responsibilities into specific files.
0.0.1+24 #
- fix
validmethod logic.
0.0.1+23 #
validNew method onBondFormStateto check a specific field validate.
0.0.1+22 #
- Added
HiddenFieldStateclass to manage the state of hidden form fields.HiddenFieldStateprovides a way to manage hidden input fields within a form.
- Updated
BondFormStatewith methods to handle hidden fields.hiddenFieldValue: Retrieves the value of a hidden field.hiddenField: Retrieves the state of a hidden field using a simplifiedgetmethod.
- Updated
RequiredValuesclass to ensure hidden field values are not null.hiddenFieldValue: Ensures the value of a hidden field is not null.
- Updated
FormControllerwith methods to update hidden field values.updateHiddenField: Updates aHiddenFieldStatewith a given value.
0.0.1+21 #
- Added the
RequiredValuesclass to ensure required form field values are not null.- Methods added to
RequiredValuesclass:textFieldValue: Ensures the value of a text field is not null.radioGroupValue: Ensures the value of a radio group field is not null.checkboxGroupValue: Ensures the first selected value of a checkbox group is not null.dropDownValue: Ensures the value of a dropdown field is not null.asyncDropDownValue: Ensures the value of an async dropdown field is not null.
- Methods added to
- Added the
requiredextension method toBondFormState.- Provides an instance of
RequiredValuesto ensure required field values are not null.
- Provides an instance of
- Updated the Dartdoc comments for
XBondFormStateextension.- Provided clear and comprehensive documentation for all methods:
textFieldValue: Retrieves the value of a text field.radioGroupValue: Retrieves the value of a radio group field.checkboxGroupValue: Retrieves the first selected value of a checkbox group.dropDownValue: Retrieves the value of a dropdown field.asyncDropDownValue: Retrieves the value of an async dropdown field.required: Returns an instance ofRequiredValuesto ensure required field values are not null.
- Provided clear and comprehensive documentation for all methods:
- Updated the Dartdoc comments for
XFormControllerextension.- Provided clear and comprehensive documentation for all methods:
updateText: Updates aTextFieldStatewith a given value.updateCheckbox: Updates aCheckboxFieldStatewith a given value.updateCheckboxGroup: Updates aCheckboxGroupFieldStatewith a given value.toggleCheckbox: Toggles the value of a specific checkbox within a checkbox group.updateDate: Updates aDateFieldStatewith a given value.updateDropDown: Updates aDropDownFieldStatewith a given value.updateAsyncDropDown: Updates aAsyncDropDownFieldStatewith a given value.updateRadioButton: Updates aRadioButtonFieldStatewith a given value.updateRadioGroup: Updates aRadioGroupFieldStatewith a given value.
- Provided clear and comprehensive documentation for all methods:
0.0.1+20 #
- fix
IsTrueandIsFalserules to deal with null value.
0.0.1+19 #
- fix
Numericrule to deal with null value.
0.0.1+18 #
- new extension methods support dealing with single bool checkbox field.
- fix
AlphaNumandAlphaDashrules to deal with null value.
0.0.1+17 #
- fix failure handling at the _onSubmit method.
0.0.1+16 #
- introduce
HasValidationErrorsmixin to update form fields state with the errors that comes from an api. services.
0.0.1+15 #
- add missing method 'updateAsyncDropDown' to
FormControllerextension.
0.0.1+14 #
- introduced the async drop down menu field state
AsyncDropDownFieldState.
0.0.1+13 #
- add more helpers methods inside
BondFormStateextension
0.0.1+12 #
- add clear method to
FormControllermixin
0.0.1+11 #
- add validate method to
FormControllermixin
0.0.1+10 #
- update readme.md file to mention the riverpod integration
0.0.1+9 #
- fix typo on readme.md file
0.0.1+8 #
- update readme.md files
- fix dart analysis issues
0.0.1+7 #
- update example.md and readme.md files
0.0.1+6 #
- fix validation localized message not rendered as excepted
0.0.1+5 #
- extract mixin FormController contains common form logic
0.0.1+4 #
- write public API has dartdoc comments
- fix dart analysis issues
0.0.1+3 #
- add necessary imports to bond form
0.0.1+2 #
- update bond_core dependency.
0.0.1+1 #
- add necessary imports to bond form
0.0.1 #
- initial release.