getValueByKey function

dynamic getValueByKey(
  1. List<Map<String, dynamic>> data,
  2. String key
)

Implementation

dynamic getValueByKey(List<Map<String, dynamic>> data, String key) {
  for (var map in data) {
    if (map["key"] == key) {
      return map["value"];
    }
  }

  return null; // Key not found
}