Instantly share code, notes, and snippets.

@jebright /map
Created Sep 23, 2018

Embed
What would you like to do?
Dart Fundamentals - Lists - Map
class Person
{
String firstName;
String lastName;
Person(this.firstName, this.lastName);
}
void main() {
List<Person> people = new List<Person>();
people.add(new Person("Joe", "Smithers"));
people.add(new Person("Patrick", "Thomas"));
var mappedNames = people.map((n) => 'Mr. ${n.firstName} ${n.lastName}');
log(mappedNames);
}
void log(var lst) {
lst.forEach((n) => print(n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment