getJSONListByValue method Null safety

List<Map<String, dynamic>> getJSONListByValue(
  1. String key,
  2. String value
)

Implementation

static List<Map<String, dynamic>> getJSONListByValue(
    String key, String value) {
  List<Map<String, dynamic>> result = [];
  for (String mapKey in _json.keys) {
    Map<String, dynamic> map = _json[mapKey]!;
    if (map.containsKey(key)) {
      if (map[key] == value) {
        result.add(map);
      }
    }
  }
  return result;
}