EventSchema<T> class
abstract
Schema validation for events MEJORA-014: Validación de Schemas
Validates event data structure before processing.
Example:
// Define a schema
final userCreatedSchema = MapSchema({
'id': StringSchema(required: true),
'email': StringSchema(required: true, pattern: r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$'),
'age': NumberSchema(min: 0, max: 150),
});
// Register with EventBus
EventSchemaValidator().registerSchema<UserCreatedEvent>(userCreatedSchema);
// Now events are validated before emission
Base class for schema validators
- Implementers
Constructors
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
-
getErrors(
T data) → List< String> - Get validation errors
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
T data) → bool - Validate the event data
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited