may i ask how to check if the map of String,String has in it's keys a specific String then i want to get the value that belong this specific key that contains the target String. for example this Map
Map<String, String> ListFinalAllInfos = {'stackoverflow': 'one', 'google': 'two'};
and i want to check if this map has this String in it's keys
stackoverflow
if stackoverflow exists as a key inside the map then i want to get the value which is
one
without converting the map to a list, if this possible. thanks in advance
Map<String, String> ListFinalAllInfos = {'stackoverflow': 'one', 'google': 'two'};
String key = ListFinalAllInfos.containsKey("stackoverflow"); // search for the key. for example stackoverflow
String value = ListFinalAllInfos[key]; // get the value for the key, value will be 'one'
if(ListFinalAllInfos.containsKey(value)){ //check if there is a key which is the value you grabbed
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With