Skip to content

Instantly share code, notes, and snippets.

@JaveedIshaq
Last active April 23, 2022 17:29
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 JaveedIshaq/c18dfb253962e519ec29345736776a34 to your computer and use it in GitHub Desktop.
Save JaveedIshaq/c18dfb253962e519ec29345736776a34 to your computer and use it in GitHub Desktop.
how to create a singleton instance of a class in dart flutter
class ContactBook {
ContactBook._sharedInstance();
static final ContactBook _shared = ContactBook._sharedInstance();
factory ContactBook() => _shared;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment