Luthor is a Dart validation library inspired by Zod. You build a schema with a fluent API, validate any value against it, and get typed data or a list of issues with flat error paths. luthor_generator writes the schemas for your json_serializable, freezed, and dart_mappable models.
import 'package:luthor/luthor.dart';
final user = l.schema({
'email': l.string().email().required(),
'age': l.int().min(18),
});
void main() {
switch (user.validate({'email': 'ada', 'age': 16})) {
case ValidationSuccess(:final data):
print(data);
case ValidationFailure(:final errors):
print(errors);
}
}This prints {email: [email must be a valid email address], age: [age must be greater than or equal to 18]}.
luthoris the validation library. It has no runtime dependencies.luthor_generatorgenerates schemas for classes annotated with@luthor.
Both need Dart 3.11 or later, or Flutter 3.41 or later.
The full documentation is at luthor.ex3.dev.
To teach your coding agent the Luthor API, install the Luthor agent skill with npx skills add exaby73/luthor.
Read AGENTS.md for the repository's rules and gotchas, and docs/architecture.md for how the runtime and the generator fit together.