0

A value of type 'Object?' can't be assigned to a variable of type 'Map<dynamic, dynamic>'. Its a Routing error

Im referring to this question. How can I return one specific argument? data["dataKey"] just gives me all arguments.

1 Answers1

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
  • 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