Im referring to this question. How can I return one specific argument? data["dataKey"] just gives me all arguments.
Asked
Active
Viewed 80 times
1 Answers
0
You can do it like-
MapEntry _entry = data.entries.singleWhere((element)=><Expression>);
print(_entry.value);
Example
Map<String, int> data = {'one': 1, 'two': 2};
MapEntry _entry = data.entries.singleWhere((element) => element.key ==
'one');
print(_entry.key);// it will print "one"
print(_entry.value); //it will print 1

Prabhanshu Tiwari
- 292
- 1
- 6
-
Thanks for quick answer. but is there nothing I can do to return one specific argument just by using some modification of `print(data["dataKey"]` ? – Daniel Moradi Jun 14 '21 at 21:11