hasKey<K, V, E> static method

Rule<Map<K, V>, E> hasKey<K, V, E>(
  1. K key, {
  2. required E error,
})

Validates that the map contains key.

MapRules.hasKey('id', error: 'Missing id')

Implementation

static Rule<Map<K, V>, E> hasKey<K, V, E>(K key, {required E error}) =>
    PredicateRule(
      predicate: (value) => value.containsKey(key),
      error: error,
    );