validation library

Shared validation contracts used by forms, entities, and repositories.

Prefer this library when a feature needs validators, validation contexts, or validation issues outside a form-specific API.

Classes

DraftModeTypedValidator<T>
Validator wrapper that carries stable metadata alongside the callable.
DraftModeValidationAfter
Raised when a value must be after a comparison date/time.
DraftModeValidationAfterOrEqual
Raised when a value must be after or equal to a comparison date/time.
DraftModeValidationDependencyContext
Extended validation context that can optionally track dependencies.
DraftModeValidationGreaterThan
Raised when a value must be greater than a comparison value.
DraftModeValidationIssue
Structured validation issue that resolves to localized text in the UI layer while still remaining usable in non-UI workflows.
DraftModeValidationMaxLength
Raised when a string exceeds the allowed length.
DraftModeValidationRequired
Raised when a required value is missing.
DraftModeValidationValueContext
Context used by reusable validation contracts to inspect related values without depending on a specific runtime like forms or repositories.

Enums

DraftModeValidatorType
Known validator families supported by DraftMode validation contracts.

Functions

lookupTypedValidator<T>(DraftModeValidator<T> validator) DraftModeTypedValidator<T>?
vAfter(dynamic compare) DraftModeValidator<DateTime>
Returns a validator that requires DateTime values to be after compare.
vAfterOrEqual(dynamic compare) DraftModeValidator<DateTime>
Returns a validator that requires DateTime values to be after or equal to compare.
vGreaterThan<T>(dynamic compare) DraftModeValidator<T>
Returns a validator that requires values to be greater than compare.
vMaxLen(int length) DraftModeValidator<String>
Returns a validator that rejects strings longer than length.
vRequired<T>() DraftModeValidator<T>
Returns a validator that rejects null and blank string values.
vRequiredOn<T>(dynamic compareAttribute) DraftModeValidator<T>
Returns a validator that requires a value when compareAttribute is true.

Typedefs

DraftModeValidator<T> = DraftModeValidationIssue? Function(DraftModeValidationValueContext? context, T? value)
Signature for validators used by field definitions and form attributes.