ZtoMap class

Fluent Zod-like validation map for use without code generation.

Define your schema once and reuse it across fromMap factories. All field issues are collected before throwing.

Example:

final _userSchema = ZtoMap({
  'name': z.string().nullable().min(3).max(100),
  'age':  z.int().nullable().max(120),
  'address': z.object({
    'street': z.string(),
    'city': z.string(),
  }),
});

factory User.fromMap(Map<String, dynamic> map) {
  _userSchema.parse(map).refine((data) {
    if ((data['age'] as int?) != null && (data['age'] as int) < 18) {
      throw ZtoException(message: 'Must be 18+', issues: []);
    }
  });
  return User(name: map['name'], age: map['age']);
}

Constructors

ZtoMap(Map<String, ZtoRule> _rules)
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(Map<String, dynamic> map) ZtoMapResult
Validates map against all rules, collecting every issue before throwing.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited