Skip to content

Instantly share code, notes, and snippets.

💙

Kristiyan Mitev komapeb

💙
Block or report user

Report or block komapeb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@komapeb
komapeb / singleton.dart
Created Jun 3, 2019
Simple Singleton pattern implementation in Dart, without using the ugly Singleton.instance or Singleton.getInstance(). Just Singleton() returns the singleton instance. Beautiful.
View singleton.dart
// Singleton logic
class Singleton {
// This makes sure Singleton() always returns the same instance
static final Singleton _instance = Singleton._();
Singleton._();
factory Singleton() {
return _instance;
}
// define any props, methods you want
You can’t perform that action at this time.