luthor
1.1.0, released 7 days ago by ex3.dev
A Dart validation library inspired by Zod with optional code generation support.
What it does
Luthor provides a fluent API for building schema validators and validating structured data in Dart and Flutter. It yields typed output and structured issues with codes, paths, and messages.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want Zod-like schema validation in Dart and Flutter.
- You need typed validation output with or without code generation.
- You want custom error messages and cross-field validation.
Skip it when
- You are looking for an all-in-one Flutter form builder UI widget library.
- You are targeting Dart versions older than 3.11.
Strengths
- Fluent and intuitive API inspired by Zod.
- Supports optional code generation for type-safe SchemaKeys and ErrorKeys.
- Zero runtime dependencies.
Weaknesses
- Requires Dart 3.11 or later.
- Requires learning a custom validation rule syntax and API.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 0
Add luthor to pubspec.yaml. Optionally add build_runner and luthor_generator for code generation features.
import 'package:luthor/luthor.dart';
final signup = l.schema({
'email': l.string().email().required(),
'password': l.string().min(8).required(),
});
void main() {
final result = signup.validate({'email': 'test@example.com'});
}Alternatives
Packages that do the same job and could replace luthor.
- acanthis
A type-safe and composable data validation library for Dart and Flutter.
75Compare - sms_autofill
Flutter plugin to provide SMS code autofill support.
80Compare - direct_select_flutter
A selection widget with a full-screen modal popup for choosing options.
83Compare - flutter_form_builder
Helps create forms in Flutter by removing boilerplate code and reusing validation.
82Compare