Validate untrusted data in Dart and Flutter. One schema, every boundary.
Describe the data you expect once. Zema checks API responses, form input, Firestore documents and local storage against it, reports every problem with its path and a translated message, and hands you clean, typed values. Pure Dart, works on mobile, desktop, web and server. No code generation.
From fromJson crashes to useful errors
User.fromJson(json) throws a TypeError on the first unexpected field, far from where the data came in, with nothing to show the user. A Zema schema reports everything at once:final signUp = z.object({
'email': z.string().email(),
'password': z.string().min(8),
'age': z.integer().gte(18).optional(),
});
final result = signUp.safeParse({'email': 'ada@', 'password': '123'});
for (final issue in result.errors) {
print('${issue.pathString}: ${issue.message}');
}
// email: Invalid email format
// password: Must be at least 8 characters
Built for the places where Dart apps break
Why not just Freezed or json_serializable?
They generate models; they do not check values.
email is a String, not a valid email. age is an int, not "18 or more". Zema covers that layer and composes with them, or replaces code generation entirely with extension types. Read the full comparison.