Skip to content

Instantly share code, notes, and snippets.

@jose-almir
Created April 2, 2020 11:59
Show Gist options
  • Save jose-almir/e6f1dca42aae4c3e3584eaa65e9f1897 to your computer and use it in GitHub Desktop.
Save jose-almir/e6f1dca42aae4c3e3584eaa65e9f1897 to your computer and use it in GitHub Desktop.
A simple singleton in dart
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