Created
April 2, 2020 11:59
-
-
Save jose-almir/e6f1dca42aae4c3e3584eaa65e9f1897 to your computer and use it in GitHub Desktop.
A simple singleton in dart
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
class Singleton { | |
static Singleton _instance = Singleton.internal(); | |
Singleton.internal(); | |
factory Singleton(){ | |
return _instance; | |
} | |
static get instance => _instance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment