Skip to content

Instantly share code, notes, and snippets.

@fvisticot
Last active October 3, 2019 22:31
Show Gist options
  • Save fvisticot/074031b3e1663b2966b4fbcf029ad5f0 to your computer and use it in GitHub Desktop.
Save fvisticot/074031b3e1663b2966b4fbcf029ad5f0 to your computer and use it in GitHub Desktop.
Singleton
void main() {
print(new Singleton() == new Singleton());
}
class Singleton {
static final Singleton _instance = Singleton._internal();
Singleton._internal();
factory Singleton() => _instance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment