rules
3.7.0, released 5 months ago by ganeshrvel.com
Type-safe, chainable validation library for Dart and Flutter.
WASM-ready
What it does
Rules provides strongly typed, immutable validation schemas with a chainable API. It supports string, integer, double, and boolean types with custom error message templating and zero runtime dependencies.
AI-written summary of version 3.7.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need type-safe validation schemas for user input in Dart or Flutter.
- You want chainable rules for strings, numbers, and booleans without runtime dependencies.
Skip it when
- You are using Rules 2.x and cannot migrate to the completely rewritten 3.x API.
- You need a complex form state management solution rather than just validation logic.
Strengths
- Strongly typed validation schemas preventing type mismatches at compile time.
- Chainable builder API with immutable schemas.
- Zero runtime dependencies.
Weaknesses
- No automated migration path from Rules 2.x to 3.x due to complete rewrite.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add rules to pubspec.yaml and import package:rules/rules.dart.
final emailRule = Rule.string(
name: 'Email',
).isRequired().isEmail();
final result = emailRule.validate('john@example.com');
print(result.ok);Alternatives
Packages that do the same job and could replace rules.