5. Validation
@serializable
class User {
@positive // Only ids >=0 are allowed.
int id;
String name;
@SizeRange(min: 0, max: 16) // Must only have at max 16 claims
@Minimum(1) // All claims must be >=1
List<int>? claims;
@polymorphic // This is not a validator
Object? attachment;
Note(this.text, this.id, this.attachment, this.claims);
}Last updated