type<T> static method

void type<T>(
  1. Value? val, [
  2. String? desc
])

Implementation

static void type<T>(Value? val, [String? desc]) {
  if (val is! T) {
    String typeStr = val == null ? "null" : "a ${val.runtimeType}";
    throw TypeException(
      "got $typeStr where a ${typeToString<T>(val as T)} was required${desc == null ? '' : ' ($desc)'}",
    );
  }
}