assertType function
Implementation
void assertType(dynamic val, List<dynamic> types, {String? message}) {
if (types.any((type) => val.runtimeType.toString() == type)) {
throw ArgumentError(
message ?? "Invalid arg: $val type should be ${types.join(" or ")}");
}
}