just_validation 0.3.0
just_validation: ^0.3.0 copied to clipboard
A simple and flexible validation library for Dart that provides validators for common use cases.
Changelog #
All notable changes to this project will be documented in this file.
0.3.0 - 2026-01-26 #
Added - Isolate Validation (Parallel Processing) #
- Isolate validation support: Execute validations in separate isolates using
Isolate.run - New methods for parallel validation:
validateIsolate(instance): Validate a single instance in an isolatevalidateManyIsolate(instances): Validate multiple instances in an isolate (batch processing)validateAsyncIsolate(instance): Async validation in an isolate
- No dependencies required: Uses Dart SDK 2.19+ built-in
Isolate.run - Universal support: Works in Flutter apps, backend Dart, CLI tools, and web
- Performance optimized: Perfect for batch processing (1000+ objects) and computationally expensive validations
- 11 new tests: Complete test coverage for isolate validation
Technical Details #
- Requires Dart SDK 2.19 or higher
- Zero additional dependencies (uses
dart:isolate) - Overhead: ~5-10ms per isolate creation
- Ideal for:
- CSV/Excel import (1000+ records)
- Background batch processing
- Complex validations (50+ rules)
- Flutter apps that cannot block UI
- Backend data processing
0.2.0 - 2026-01-25 #
Added - Advanced Validators #
- IP Address validation: IPv4, IPv6, or both formats
- MAC Address validation: Supports colon, hyphen, and no-separator formats
- GPS Coordinates validation: Latitude (-90 to 90) and Longitude (-180 to 180)
- Credit Card validation: Luhn algorithm, 13-19 digits, supports spaces/hyphens
- IBAN validation: Full Mod-97 algorithm, 52 countries supported
- ISBN validation: ISBN-10 and ISBN-13 with checksum validation
- UUID validation: Versions 1, 2, 3, 4, and 5
- Postal Code validation: 129 countries worldwide organized by region
- América del Norte (12): US, CA, MX, CR, PA, GT, SV, HN, NI, CU, DO, PR
- América del Sur (10): BR, AR, CL, CO, PE, VE, EC, BO, PY, UY
- Europa Occidental (18): GB, FR, DE, ES, IT, NL, BE, CH, AT, PT, IE, LU, MC, AD, SM, LI, VA, GI
- Europa Nórdica (5): SE, NO, DK, FI, IS, FO, GL
- Europa Oriental (25): PL, CZ, SK, HU, RO, BG, HR, SI, EE, LV, LT, UA, BY, MD, RS, BA, MK, AL, GR, CY, MT, ME, XK
- Rusia y Asia Central (5): RU, KZ, AM, AZ, GE
- Asia Oriental (6): JP, CN, KR, TW, HK, MO
- Sudeste Asiático (10): TH, VN, MY, SG, ID, PH, MM, KH, LA, BN
- Asia del Sur (7): IN, PK, BD, LK, NP, BT, MV
- Oriente Medio (13): TR, IL, SA, AE, QA, KW, BH, OM, JO, LB, IQ, IR, PS
- África (13): ZA, EG, MA, DZ, TN, LY, KE, NG, ET, GH, MR, MU, LC
- Oceanía (5): AU, NZ, PG, FJ, VG
Added - Inline Validation Extensions #
- All 8 advanced validators available as inline extensions
.validateIPv4,.validateIPv6,.validateMACAddress.validateLatitude,.validateLongitude.validateCreditCard,.validateIBAN,.validateISBN,.validateUUID
Added - Examples and Tests #
- New example:
advanced_validation_example.dartdemonstrating all advanced validators - 39 new tests for advanced validators (Validator Pattern + Inline)
- Total tests: 104 (all passing ✅)
Statistics #
- Total validators: 28 (20 basic + 8 advanced)
- Total tests: 104 (100% passing)
- Total lines of code: ~2,762 lines
- Code coverage: 100% on core functionality
0.1.0 #
Initial Release #
Core Features
- ✅ Fluent API for building validation rules
- ✅ Strong typing and null-safety support
- ✅ Comprehensive built-in validators
String Validators
notEmpty()- Ensures string is not emptynotNull()- Ensures value is not nulllength(min, max)- Validates string length rangeminLength(length)- Validates minimum lengthmaxLength(length)- Validates maximum lengthexactLength(length)- Validates exact lengthemailAddress()- Validates email formaturl()- Validates URL formatmatches(regex)- Validates against regex patternalpha()- Validates alphabetic characters onlyalphanumeric()- Validates alphanumeric characters only
Number Validators
greaterThan(value)- Value must be greater than specifiedgreaterThanOrEqual(value)- Value must be greater than or equallessThan(value)- Value must be less than specifiedlessThanOrEqual(value)- Value must be less than or equalinclusiveBetween(from, to)- Value must be within inclusive rangeexclusiveBetween(from, to)- Value must be within exclusive range
Comparison Validators
equal(value)- Value must equal specified valuenotEqual(value)- Value must not equal specified valueequalTo(property)- Value must equal another propertynotEqualTo(property)- Value must not equal another property
Collection Validators
notEmpty()- Collection must not be emptyminLength(length)- Collection must have minimum itemsmaxLength(length)- Collection must have maximum itemsexactLength(length)- Collection must have exact number of items
Custom Validators
must(predicate, message)- Custom synchronous validationmustWith(predicate, message)- Custom validation with object contextmustAsync(predicate, message)- Custom asynchronous validationmustAsyncWith(predicate, message)- Custom async validation with context
Advanced Features
- Conditional validation with
when()andunless() - Custom error messages with
withMessage() - Cascade modes (continue or stop on first failure)
- Nested object validation with
ruleForEach() - Asynchronous validation support
- Rich validation results with detailed error information
Documentation
- Comprehensive README with examples
- API documentation with dartdoc comments
- Example applications demonstrating:
- Basic validation
- Complex nested validation
- Asynchronous validation
- Flutter integration
Testing
- 47+ unit tests covering all validators
- Integration tests for complex scenarios
- 100% code coverage on core functionality