isJSONList function

bool isJSONList(
  1. Object? json
)

Returns true if value is a JSON List.

Implementation

bool isJSONList(Object? json) {
  if (json == null) return false;

  if (json is List<String>) return true;
  if (json is List<num>) return true;
  if (json is List<int>) return true;
  if (json is List<double>) return true;
  if (json is List<bool>) return true;

  if (json is List) {
    return json.isEmpty || listMatchesAll(json, isJSON);
  }

  return false;
}