Last active
October 3, 2019 22:27
-
-
Save fvisticot/c4283c1234c396405a4d35772064383d to your computer and use it in GitHub Desktop.
lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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