assertValidValue function

void assertValidValue(
  1. Map m,
  2. String k,
  3. Type t
)

Assert that the value for key k in Map m is non-null and is of Type t. Throws an ArgumentError if the value is null, or is not of Type t.

Implementation

void assertValidValue(Map m, String k, Type t) {
  var v = m[k];
  if (v == null || v.runtimeType != t) {
    throw ArgumentError(
        'Parameter $k should be a $t but is actually a ${v.runtimeType} with value $v');
  }
}