isJSONMap function
Returns true
if value
is a JSON Map<String,?>.
Implementation
bool isJSONMap(Object? json) {
if (json == null) return false;
if (json is Map<String, String>) return true;
if (json is Map<String, num>) return true;
if (json is Map<String, int>) return true;
if (json is Map<String, double>) return true;
if (json is Map<String, bool>) return true;
if (json is Map) {
if (json.isEmpty) return true;
if (!isMapOfStringKeys(json)) return false;
return listMatchesAll(json.values, isJSON);
}
return false;
}