ValueContainer<T, E> class

Separate values and validate them Ease error validation

Constructors

ValueContainer({String name = 'ValueContainer', T? value, required ValueValidator<T, E> validator})

Properties

currentErrorType Type?
returns current error runtime type
no setter
currentValueType Type?
returns current value runtime type
no setter
error → E
returns the current error
no setter
errorType Type
returns generic error Type (E)
no setter
hasError bool
returns true is error is not null
no setter
hashCode int
The hash code for this object.
no setterinherited
hasValue bool
returns true if error is null
no setter
isValid bool
returns true if error is null
no setter
name String
the current container name
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
returns the current value
no setter
valueType Type
returns generic value Type (T)
no setter

Methods

hasErrorOf<ET>() bool
returns true if hasError and error type is ET
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onErrorOf<ET>(void callback(T? value, ET error)) → void
call callback if hasError and error type is ET
toString() String
A string representation of this object.
override

Operators

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