flutter_validators
1.3.0, released 2 months ago by stac.dev
String validators, sanitizers, and Flutter form validation helpers
What it does
Provides over 40 string validation functions and 13 sanitizers, available as top-level functions, String extensions, and Flutter TextFormField validator closures. Covers emails, URLs, numbers, regex, and encoding formats without any runtime dependencies.
AI-written summary of version 1.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to validate string formats like emails, URLs, phone numbers, or credit cards
- You want seamless TextFormField validation closures for Flutter forms
- You need to sanitize and normalize user input strings
Skip it when
- You need complex multi-field cross-form validation logic that requires state management between inputs
Strengths
- Zero runtime dependencies and pure Dart implementation
- Multiple usage styles including top-level functions, String extensions, and form validators
- Comprehensive coverage of standard validation rules and sanitizers
Weaknesses
- Limited to string-based validation and parsing tasks
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:flutter_validators/flutter_validators.dart';
'foo@bar.com'.isEmail;
'https://google.com'.isURL;
TextFormField(
validator: Validator.email(errorMessage: 'Enter a valid email'),
);Alternatives
Packages that do the same job and could replace flutter_validators.
- formz
If you prefer a model-driven validation approach with explicit validation states rather than simple string form validator functions.
90Compare - email_validator
If you only need standalone email address validation and want a smaller, single-purpose package.
50Compare - string_validator
If you are looking for the original JavaScript validator port without the additional Flutter form integration wrapper.
64Compare
Works with
Packages commonly used together with flutter_validators: ones it builds on, ones built on it, and its own family.