Factory class for creating Map validation rules.
Example
final settingsValidator = Validate.all<Map<String, dynamic>, String>([
MapRules.hasKeys(['theme', 'language'], error: 'Missing settings'),
MapRules.maxSize(20, error: 'Too many settings'),
]);
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
-
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
Static Methods
-
hasKey<
K, V, E> (K key, {required E error}) → Rule< Map< K, V> , E> -
Validates that the map contains
key. -
hasKeys<
K, V, E> (Iterable< K> keys, {required E error}) → Rule<Map< K, V> , E> -
Validates that the map contains all
keys. -
maxSize<
K, V, E> (int max, {required E error}) → Rule< Map< K, V> , E> -
Validates that the map has at most
maxentries. -
minSize<
K, V, E> (int min, {required E error}) → Rule< Map< K, V> , E> -
Validates that the map has at least
minentries. -
notEmpty<
K, V, E> ({required E error}) → Rule< Map< K, V> , E> - Validates that the map is not empty.