Skip to content

Instantly share code, notes, and snippets.

@fvisticot
Last active October 3, 2019 22:27
Show Gist options
  • Save fvisticot/c4283c1234c396405a4d35772064383d to your computer and use it in GitHub Desktop.
Save fvisticot/c4283c1234c396405a4d35772064383d to your computer and use it in GitHub Desktop.
lambda
void main() {
const books = [
const Book('book1', "book1 desc"),
const Book('book2', "book2 desc")
];
print("Books: $books");
books.forEach((book) => print("${book.title}"));
var titles = books.map((book) => book.title).toList();
print(titles);
}
class Book {
final title;
final description;
const Book(this.title, this.description);
String toString() {
return '$title, $description';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment