Dart Map getter isn’t defined for Map<String, String>

  dart, dictionary, javascript, object

I am new on Dart, I want to map a list of objects to only get the attribute firstName, but I am getting that error:

````
Error: The getter 'firstName' isn't defined for the class 'Map<String, String>'.
 - 'Map' is from 'dart:core'.
````

````
void main() {
  var employes = [
  {"firstName":"John", "lastName":"Doe"},
  {"firstName":"Anna", "lastName":"Smith"},
  {"firstName":"Peter", "lastName":"Jones"}
];
  var mapFirstName = employes.map((detail) { return {"firstName": detail.firstName}});

  print(mapFirstName);
}
````

How I can fix it?

Source: Ask Javascript Questions

LEAVE A COMMENT