value_objects library
Pure-Dart value objects for common text, numeric, contact, identifier, network, money, and date-range domains.
Each value object validates with the matching validator from
validation.dart and reports failures as its *ValidationIssue types.
Classes
- DateRange
- Immutable representation of a validated date range with start and end UTC DateTimes.
- DateRangeInvalidOrderIssue
- The start of the range is after its end.
- DateRangeValidationIssue
- Base type for date-range validation failures.
- DateRangeValidator
- Validator for date ranges.
- DateRangeValue
- Immutable domain value object representing a validated date range.
-
Either<
L, R> - A generic type that represents a value of one of two possible types (a disjoint union).
- A value object representing a validated email address.
- IdentifierValue
- Immutable domain value object representing a validated identifier.
-
Left<
L, R> - Represents the failure or error side of an Either.
- Money
- A value object representing a non-negative monetary amount.
- MoneyDecimalPlacesExceededIssue
- The amount has more decimal places than the currency allows.
- MoneyEmptyIssue
- The amount input is empty.
- MoneyInvalidCurrencyIssue
- The currency code is not a valid ISO 4217 code.
- MoneyInvalidFormatIssue
- The amount input is not a valid decimal number.
- MoneyNegativeNotAllowedIssue
- The amount is negative and negatives are not allowed.
- MoneyOutOfRangeIssue
-
The amount exceeds the largest value
Moneycan hold exactly. - MoneyTooLargeIssue
- The amount is above the configured maximum.
- MoneyTooSmallIssue
- The amount is below the configured minimum.
- MoneyUnsupportedCurrencyIssue
- The currency is valid but not in the allowed set.
- MoneyValidationConfig
- Configuration rules for valid money values.
- MoneyValidationIssue
- Base type for money validation failures.
- MoneyValidator
- A class responsible for validating monetary inputs according to a MoneyValidationConfig.
- NetworkAddressValue
- Immutable domain value object representing a validated network address.
- NumberValue
- A value object representing a validated number.
- Password
- A value object representing a validated password.
- PhoneValue
- Immutable domain value object representing a validated phone number string.
-
Right<
L, R> -
A concrete implementation of Either that represents the successful value (
Right) in a computation. - TextValue
- A value object representing a validated text string.
- UrlValue
- Immutable domain value object representing a validated Uri.
-
ValueObject<
T> - Base class for single-value domain value objects.
Enums
- Currency
- Supported ISO 4217 currencies for ecommerce money values.
Extensions
- GmanaDateRangeX on DateRange
- Inclusive interval operations for DateRange.
-
MoneyIterableX
on Iterable<
Money> - Helpers for summing collections of Money.
Functions
-
resolveDateRangeValidationIssue(
DateRangeValidationIssue issue) → String - Default English messages for date-range validation issues.
-
resolveMoneyValidationIssue(
MoneyValidationIssue issue) → String - Default English messages for money validation issues.
Exceptions / Errors
- ValueObjectException
- Thrown by a value object's constructor when the input is invalid.