Skip to content

Instantly share code, notes, and snippets.

@Jay-flow
Created February 12, 2022 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jay-flow/f549a98fcbd4d78d0f79802334cbf6b7 to your computer and use it in GitHub Desktop.
Save Jay-flow/f549a98fcbd4d78d0f79802334cbf6b7 to your computer and use it in GitHub Desktop.
Dart singleton example
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