Skip to content

Instantly share code, notes, and snippets.

@mdrideout
Last active September 10, 2022 18:31
Show Gist options
  • Save mdrideout/9b55eab93919d3c19733157f3c7825ca to your computer and use it in GitHub Desktop.
Save mdrideout/9b55eab93919d3c19733157f3c7825ca to your computer and use it in GitHub Desktop.
solar-arc-1468
class Author {
final String id;
final String handle;
String name;
Author({
required this.id,
required this.handle,
required this.name,
});
void setName(String newName) {
name = newName;
}
get getName => name;
}
void main() {
Map<String, Author?> authorCache = {};
Author sampleAuthor = Author(
id: "zxcvbnm",
handle: "goodauthor",
name: "Arthur McAuthor",
);
authorCache['zxcvbnm'] = sampleAuthor;
authorCache['goodauthor'] = sampleAuthor;
sampleAuthor.setName("New Name");
print(authorCache['zxcvbnm']?.getName);
print(authorCache['goodauthor']?.getName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment