hey I have like that List

List<String> list = ['a', 'b', 'c'];

and ı have like that map

Map<String, String> map = {'Hello': 'a', 'How': 'b', 'You': 'c'};

I want make function like that if is a i want return Hello how can i do it can you help me ?

find(a) {
 //return Hello
}


Solution 1: encubos

I don't know if I understand you correctly.

Try this, you retrieve the key using the value

Map<String, String> map = {'Hello': 'a', 'How': 'b', 'You': 'c'};

// search for 'b' value 
var data = map.keys.firstWhere((k) => map[k] == 'b', orElse: () => null);

print(data); // prints 'How'