x_validators 2.0.0 copy "x_validators: ^2.0.0" to clipboard
x_validators: ^2.0.0 copied to clipboard

Simple, composable, zero-dependency form and text validation for Dart and Flutter. Stack rules and plug straight into TextFormField.

[1.0.0]-[2-1-2024] initial version #

  • initial version

[1.0.1]-[2-1-2024] initial version #

  • fix readme

[1.0.2]-[8-1-2024] Update README #

  • refactor:โ™ป๏ธ ๐Ÿ—‘๏ธ Improve code readability

[1.0.3]-[8-1-2024] Update README #

  • fix readme

[1.0.4]-[8-1-2024] Update README #

  • refactor:โ™ป๏ธ ๐Ÿ—‘๏ธ Improve code readability
  • docs:๐Ÿ“ Update README

[1.0.5]-[11-1-2024] fix #

  • refactor:โ™ป๏ธ ๐Ÿ—‘๏ธ Improve code readability
  • docs:๐Ÿ“ Update README
  • fix: ๐Ÿ› ๏ธ๐ŸžFixed the Bug with v1.0.4

[1.0.6]-[11-1-2024] Update README #

  • refactor:โ™ป๏ธ ๐Ÿ—‘๏ธ Improve code readability

[1.0.7]-[11-1-2024] Update DOC #

  • docs:๐Ÿ“ Update Doc

[1.0.8]-[21-04-2024] Update DOC #

  • docs:๐Ÿ“ Update Doc (Support Palestine)

[1.1.0]-[01-06-2026] Exports, consistency & full test suite #

  • fix: ๐Ÿž Export previously-unreachable rules (IsIpAddress, IsSecureUrl, IsArabicChars, IsEnglishChars, IsNumbersOnly)
  • fix: ๐Ÿž Export the XValidatorsLocalization hook so custom error-message translation is usable by consumers
  • feat: โœจ Add const constructors across all rules for cleaner, allocation-free usage
  • test: โœ… Add a comprehensive unit-test suite covering every rule and the xValidator orchestrator
  • docs:๐Ÿ“ Rewrite the README with accurate API tables, localization and custom-rule guides
  • chore: ๐Ÿงน Resolve all dart analyze issues

[1.2.0]-[01-06-2026] Docs, full coverage & SDK bump #

  • chore: โฌ†๏ธ Raise the minimum Dart SDK to ^3.8.0
  • docs: ๐Ÿ“ Add dartdoc across the public rule API (classes and validation functions) and fix several inaccurate/typo'd doc strings
  • test: โœ… Expand the suite to 100% line coverage (149 tests): quoted & IP-literal (IPv4/IPv6) email parsing, default-message (toString) contracts, numeric min/max raw-num paths, and containsAny trim/case flags
  • chore: โฌ†๏ธ Bump the example app to flutter_lints ^6.0.0
  • style: ๐ŸŽจ Adopt the Dart "tall" formatting style

[1.3.0]-[01-06-2026] Message API, key cleanup, RegExp hoisting & IsOptional fix #

  • feat: โœจ Add a dedicated defaultMessage getter as the message API for rules; the base implementation delegates to toString(), so existing custom rules that override toString() keep working unchanged
  • fix: ๐Ÿž IsOptional is now honored regardless of its position in the rule list โ€” optionality is resolved by an up-front scan, fixing the case where an empty value wrongly failed when IsOptional was placed after another rule
  • fix: ๐Ÿž Normalize malformed/typo'd default-message keys to stable validation.* keys (is_notport โ†’ is_not_port, hex-color, date-after, min/max length, url, facebook/instagram/youtube url, required); consumers using an inline error: or a registered translator are unaffected
  • perf: โšก Hoist per-call RegExps to top-level final constants (compiled once) across the phone, language, number, url and color rules, and collapse the hex-color check from two patterns into one
  • refactor: โ™ป๏ธ Remove dead branches in match, minValue and maxValue
  • chore: ๐Ÿ—‘๏ธ Deprecate the no-op ContainsAny.caseSensitive field (currently ignored; it will be wired up as a constructor parameter in v2.0.0)
  • test: โœ… Migrate the default-message contracts to defaultMessage, add an IsOptional position-independence regression and defaultMessage fallback-chain coverage (152 tests)

[2.0.0]-[01-06-2026] Breaking: behavior corrections & tightened rules #

This is a behavior-only major release. The public API shape is unchanged (same rules, same xValidator signature); several rules were tightened to match their names. See the Migrating to 2.0.0 guide in the README for adaptation steps.

  • BREAKING fix: ๐Ÿž null input is now treated as an empty string instead of short-circuiting the validator to "valid", so IsRequired correctly rejects null; add IsOptional to let empty/null pass
  • BREAKING fix: ๐Ÿž IsNumber now accepts integers only (decimals, hex and scientific notation are rejected) โ€” use the new IsDecimal rule for fractional values
  • BREAKING feat: โœจ Add IsDecimal rule + isDecimal helper (backed by double.tryParse, key validation.must_be_double) for fractional-number validation
  • BREAKING fix: ๐Ÿž IsArabicChars now accepts Arabic-Indic digits ู -ูฉ only; the previous \p{N} token (no unicode flag) matched the literal characters p{N} and no real digits
  • BREAKING fix: ๐Ÿž IsNumbersOnly is now anchored (^[0-9]+$) and passes only when the whole input is digits, instead of passing whenever a digit appeared anywhere
  • BREAKING fix: ๐Ÿ”’ Anchor IsFacebookUrl, IsInstagramUrl and IsYoutubeUrl so domain-suffix spoofing (e.g. https://facebook.com.evil.com) is rejected
  • BREAKING fix: ๐Ÿ”’ IsIpAddress now uses a strict dotted-quad regex โ€” leading zeros (192.168.001.001) and surrounding/embedded whitespace are rejected
  • BREAKING fix: ๐Ÿž Wire up ContainsAny.caseSensitive as a real constructor parameter; error moves from a positional to a named argument (ContainsAny(values, {caseSensitive = false, error}))
  • BREAKING fix: ๐Ÿž Give IsArabicNum and IsHindiNum distinct default-message keys (validation.must_be_arabic_num / validation.must_be_hindi_num) instead of the shared validation.must_be_num
  • feat: โœจ Broaden IsUrl to accept hyphenated hosts, deep subdomains and long TLDs (https://my-site.co.uk, https://a.b.example.com, https://example.museum)
  • refactor: โ™ป๏ธ Remove static mutable parser state from EmailXValidator; each validate call now runs on a fresh single-use parser (public signature and behavior unchanged)
  • refactor: โ™ป๏ธ Rename the typo'd isInstgramUrlValid helper to isInstagramUrlValid (old name kept as a @Deprecated alias) and the files text/is_not_empty.dart โ†’ text/is_required.dart and urls/is_instgram_url.dart โ†’ urls/is_instagram_url.dart
  • docs: ๐Ÿ“ Add a "Migrating to 2.0.0" guide and update the API tables, localization resolution order and "Good to know" notes
  • test: โœ… Update and extend the suite for every behavior change (new IsDecimal and strict-IP groups, flipped known-behavior cases)
10
likes
160
points
167
downloads

Documentation

API reference

Publisher

verified publisherbasuony.com

Weekly Downloads

Simple, composable, zero-dependency form and text validation for Dart and Flutter. Stack rules and plug straight into TextFormField.

Repository (GitHub)
View/report issues

Topics

#validation #validator #form #form-validation #flutter

License

MIT (license)

More

Packages that depend on x_validators