form_shield 0.4.0
form_shield: ^0.4.0 copied to clipboard
A declarative, rule-based form validation library for Flutter apps. Supports async validation, custom validation logic, and more.
Changelog #
[0.4.0] - 2025-04-08 #
Added #
- Introduce
AsyncValidator
class for handling asynchronous validation - New
CompositeValidator
class for combining multiple validators (to offer an unified API for both sync and async validation) - Update readme with new async validation examples
[0.3.0] - 2025-04-05 #
Added #
- Asynchronous validation support:
- New
AsyncValidationRule
base class for creating async-specific validation rules - Async validation state tracking with
AsyncValidationState
class - Debouncing support for async validation to prevent excessive API calls
- Manual async validation triggering with
validateAsync()
method - Example implementation of username availability checking
- New
- New properties for validation state management:
isValidating
- Indicates if async validation is in progressisValid
- Indicates if the last async validation was successfulerrorMessage
- Provides the current error message from either sync or async validation
[0.2.0] - 2025-04-04 #
Added #
- New validation rules:
DateRule
- Validates dates with min and max constraintsDateRangeRule
- Validates date ranges between two fieldsURLRule
- Validates URLs with optional protocol checkingIPAddressRule
- Validates IPv4 and IPv6 addressesCreditCardRule
- Validates credit card numbers with Luhn algorithm
- Updated documentation
Changed #
- Improved error message formatting
- Enhanced type inference for validation rules
- Better handling of null values
- Updated documentation with more examples
Fixed #
- Edge cases in phone number validation
- Memory leak in form validation
- Type conversion issues in numeric validators
[0.1.0] - 2025-04-03 #
Added #
- Initial release of Form Shield
- Core validation framework with
ValidationRule
abstract class andValidationResult
class Validator
class with support for chaining multiple validation rules- Type-specific validator factory methods:
forString()
,forNumber()
,forBoolean()
, andforDate()
- Built-in validation rules:
RequiredRule
- Validates that a value is not null or emptyEmailRule
- Validates email addresses with customizable regex patternPasswordRule
- Validates passwords with configurable complexity requirementsPasswordMatchRule
- Validates that passwords matchLengthRule
- Validates string length with min and max constraintsMinLengthRule
- Validates minimum string lengthMaxLengthRule
- Validates maximum string lengthValueRule
- Validates numeric values with min and max constraintsMinValueRule
- Validates minimum numeric valueMaxValueRule
- Validates maximum numeric valuePhoneRule
- Validates phone numbersCountryPhoneRule
- Validates phone numbers for specific countriesCustomRule
- Allows custom validation logic with fixed error messageDynamicCustomRule
- Allows custom validation logic with dynamic error messages
- Seamless integration with Flutter's form validation system
- Example login form implementation