Skip to content

Instantly share code, notes, and snippets.

@TekExplorer
Last active January 13, 2023 16:55
Show Gist options
  • Save TekExplorer/8a7a048d85c36cc9d50e802ff67742d0 to your computer and use it in GitHub Desktop.
Save TekExplorer/8a7a048d85c36cc9d50e802ff67742d0 to your computer and use it in GitHub Desktop.
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