Last active
October 3, 2019 22:31
-
-
Save fvisticot/074031b3e1663b2966b4fbcf029ad5f0 to your computer and use it in GitHub Desktop.
Singleton
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
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