I am learning on how to use lookup in Flutter, this is an example that I came across.
void main() {
Map<List<String>, String> lookup = {
['foo', 'bar']: 'foobar',
['baz', 'qux']: 'bazqux',
['hello', 'world']: 'helloworld',
};
List<String> key = ['foo', 'bar'];
String? result = lookup[key];
if (result != null) {
print('Result: $result');
} else {
print('No match found for $key');
}
}
But the problem is the result is 'No match found for ['foo','bar'], although the code is correct. It is supposed to return 'foobar' as the result, but I am not sure where the problem is and how to fix it.