Skip to content

Instantly share code, notes, and snippets.

@haberman
Created February 27, 2023 17:20
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 haberman/cf79d4cfef0ca73453228970091de8c4 to your computer and use it in GitHub Desktop.
Save haberman/cf79d4cfef0ca73453228970091de8c4 to your computer and use it in GitHub Desktop.
mellow-jungle-4935
class Getter<T> {}
extension on Getter<int> {
int get() => 42;
}
extension on Getter<String> {
String get() => "the answer to life, the universe, and everything";
}
void main() {
var intGetter = Getter<int>();
var strGetter = Getter<String>();
print(intGetter.get());
print(strGetter.get());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment