NumberMessage<T extends num> class
A message container for validation errors related to numerical values.
This class extends BaseMessage and provides validation messages specific
to numerical types, supporting generic types that extend num, such as int and double.
Example
final numberMessages = NumberMessage<int>(
min: (value) => 'The number must be at least $value',
max: (value) => 'The number must be at most $value',
positive: 'The number must be positive',
negative: 'The number must be negative',
);
- Inheritance
-
- Object
- BaseMessage
- NumberMessage
- Implementers
Constructors
- NumberMessage({String? any, ArrayMessage? array, String? every, String? refine, String? required, String between(T min, T max)?, String? negative, String max(T max)?, String min(T min)?, String multipleOf(T multipleOf)?, String? positive})
-
Creates a new instance of
NumberMessagewith customizable validation messages.
Properties
- any → String
-
The error message used when at least one of multiple validators must pass (
orcondition).finalinherited - array → ArrayMessage
-
The error message container for array-related validation errors.
finalinherited
- between → String Function(T min, T max)
-
Message for the validation that ensures a number is within a range.
final
- every → String
-
The error message used when all of multiple validators must pass (
andcondition).finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- max → String Function(T max)
-
Message for the maximum allowed value validation.
final
- min → String Function(T min)
-
Message for the minimum allowed value validation.
final
- multipleOf → String Function(T multipleOf)
-
Message for the "multiple of" validation.
final
- negative → String
-
Message for the validation that ensures a number is negative.
final
- positive → String
-
Message for the validation that ensures a number is positive.
final
- refine → String
-
The error message used when a custom refinement validation fails.
finalinherited
- required → String
-
The error message used when a required value is missing.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{String? any, ArrayMessage? array, String? every, String? refine, String? required}) → BaseMessage -
Creates a copy of the current
BaseMessageinstance with updated values.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited