Assert class
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;
}
Constructors
Properties
- eval → String
-
A string representation of the source code that will be executed by the assert.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String?
-
An optional message to show if the assertion failed.
final
- 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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited