CrystallisData class abstract mixin

Mixin class that provides validation functionality for data classes. Applied to classes generated with Crystallise.

Implementers

Constructors

CrystallisData()

Properties

config Crystallise
Crystallise configuration
no setter
hashCode int
The hash code for this object.
no setterinherited
metadata Map<String, FieldMetadata>
Per-field metadata of this data class.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assertSet<T>(String field, T value) → void
Asserts that the field can be set with the given value, and throws List<ValidationException> if any validators fail. Throws ArgumentError if the field does not exist or if the value is of the wrong type.
get(String field) Object?
Get the value of a field by name. To see what type it might be, check metadata.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize() Map<String, dynamic>
Serializes this object into a Map<String, dynamic>
set<T>(String field, T value) → void
Set the value of a field by name.
setFrom(CrystallisData other) → void
Copies compatible fields from any other instance of CrystallisData. Incompatible fields (missing or type-mismatched) are skipped. Null values are skipped.
toString() String
A string representation of this object.
inherited
tryGet<T>(String field) → T?
Try to get the value of a field by name, returning null if:
validate() Map<String, List<ValidationException>>
Validate all fields (including those with zero validators)
validateField(String field) List<ValidationException>
Validate a single field

Operators

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

Constants

nullValue → const _NullableSentinel
Nullable value sentinel used in generated copyWith methods.