Created with <3 with dartpad.dev.
Created
September 14, 2023 09:32
-
-
Save Deleplace/b0711fb19401f796b1d4a7c93ea55dd0 to your computer and use it in GitHub Desktop.
fluttering-midnight-6937
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
class Person { | |
String id; | |
String firstName, lastName; | |
Person(this.id, this.firstName, this.lastName); | |
@override | |
String toString() { | |
return "$firstName $lastName"; | |
} | |
} | |
void main() { | |
final a = [ | |
Person("a", "Alice", "Smith"), | |
Person("b", "Bob", "Smith"), | |
Person("c", "Carol", "Smith"), | |
]; | |
print("a = $a"); | |
final m = { | |
for (final e in a) e.id: e, | |
}; | |
print("m = $m"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment