isMapOfStringKeysAndListValues function

bool isMapOfStringKeysAndListValues(
  1. Map? map
)

Returns true if map has String keys and List values.

Implementation

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

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

  return true;
}