Skip to content
pubscout

form_validator

2.1.1, released 4 years ago by themisir.com

Simplest form validation library for Flutter's form field widgets.

WASM-ready
$ flutter pub add form_validator
Source repository

What it does

Provides a fluent ValidationBuilder API to compose common form field validators such as email, phone, length, URL, IP, and custom regular expressions. Supports localization out of the box and custom validation rules via extension methods.

AI-written summary of version 2.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want a clean, chainable builder pattern to validate Flutter form fields quickly.
  • You need built-in validation rules for emails, URLs, phones, and regular expressions with localization support.

Skip it when

  • You are using a state-management form library like formz that handles form state and validation together as value objects.
  • You prefer annotation-based or model-driven validation.

Strengths

  • Zero dependencies
  • Built-in localization support for multiple languages
  • Easily extensible via Dart extension methods

Weaknesses

  • ValidationBuilder instances are mutable, requiring separate instances per field configuration

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
TextFormField(
  validator: ValidationBuilder().email().maxLength(50).build(),
  decoration: InputDecoration(labelText: 'Email'),
)

Alternatives

Packages that do the same job and could replace form_validator.

  • formz

    Choose formz if you prefer a model-driven approach treating form inputs as value objects with status and validation states.

  • string_validator

    Choose string_validator if you only need a collection of string checking functions without a builder pattern.