Assert constructor
A decorator that allows adding assert(...)
on the generated classes.
Usage example:
abstract class Person with _$Person {
@Assert('name.trim().isNotEmpty', 'name cannot be empty')
@Assert('age >= 0')
factory Person({
String name,
int age,
}) = _Person;
}
Implementation
const Assert(this.eval, [this.message]);