Skip to content

Instantly share code, notes, and snippets.

@Deleplace
Created September 14, 2023 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deleplace/b0711fb19401f796b1d4a7c93ea55dd0 to your computer and use it in GitHub Desktop.
Save Deleplace/b0711fb19401f796b1d4a7c93ea55dd0 to your computer and use it in GitHub Desktop.
fluttering-midnight-6937

fluttering-midnight-6937

Created with <3 with dartpad.dev.

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