Created
February 12, 2022 07:27
-
-
Save Jay-flow/f549a98fcbd4d78d0f79802334cbf6b7 to your computer and use it in GitHub Desktop.
Dart singleton example
This file contains hidden or 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
class Singleton { | |
Singleton._privateConstructor(); | |
static final Singleton _instance = Singleton._privateConstructor(); | |
factory Singleton() { | |
return _instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment