isMapOfStringKeysAndNumValues function

bool isMapOfStringKeysAndNumValues(
  1. Map? map
)

Returns true if map has String keys and num values.

Implementation

bool isMapOfStringKeysAndNumValues(Map? map) {
  if (map == null) return false;
  if (map is Map<String, num>) return true;
  if (map.isEmpty) return false;

  if (listNotMatchesAll<MapEntry>(
      map.entries, (e) => (e.key is String) && (e.value is num))) return false;

  return true;
}