Last active
January 13, 2023 16:55
-
-
Save TekExplorer/8a7a048d85c36cc9d50e802ff67742d0 to your computer and use it in GitHub Desktop.
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
void main() { | |
final isIdentical = identical(Singleton(), Singleton()); | |
print(isIdentical); | |
assert(isIdentical == true); | |
} | |
class Singleton { | |
static final Singleton _instance = Singleton._(); | |
const Singleton._(); | |
factory Singleton() => _instance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment