string_validator
1.2.0, released a year ago by suragch.dev
String validation and sanitization library for Dart.
What it does
Provides a comprehensive set of string validation and sanitization functions, such as checking for email formats, URLs, numeric values, and cleaning or escaping string inputs. It also supports extension methods to call these functions directly on string instances.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to validate user inputs like emails, URLs, or specific formats.
- You want to sanitize and clean strings before processing or storing them.
Skip it when
- You are building complex multi-field form validation schemas that require form state management.
- You need specific UI text field masking inputs.
Strengths
- Extensive collection of validators and sanitizers ported from validator.js.
- Convenient extension methods for direct usage on String instances.
- No external dependencies and supports all platforms.
Weaknesses
- Does not integrate directly into Flutter's Form/FormField validation state out of the box without manual callbacks.
- Limited to string operations only.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:string_validator/string_validator.dart';
void main() {
String email = 'example@gmail.com';
bool isEmailValid = email.isEmail;
String url = 'https://example.com';
bool isUrlValid = url.isURL();
}Alternatives
Packages that do the same job and could replace string_validator.
- email_validator
Pick this alternative if you specifically only need robust email address validation.
50Compare - formz
Pick this alternative if you need robust standalone form validation models with status handling.
90Compare
Works with
Packages commonly used together with string_validator: ones it builds on, ones built on it, and its own family.
- any_link_previewBuilt on string_validatorA Flutter widget that fetches and displays web link previews with customization and caching.
- barbecueBuilt on string_validatorRender text tables for CLI-based Dart applications with custom borders, padding, and ANSI colors.
- metadata_fetchBuilt on string_validatorExtracts metadata such as OpenGraph, Twitter Cards, and JSON-LD from web pages.
- ogp_data_extractBuilt on string_validatorExtracts Open Graph protocol metadata and favicons from web pages.
- dartarabicBuilt on string_validatorA Dart library providing functions to manipulate Arabic letters, diacritics, and text.