Skip to content

Instantly share code, notes, and snippets.

@yusirdemir
Created November 5, 2020 22:04
Show Gist options
  • Save yusirdemir/0dd2fa7c7367d6cddeec3b08dad5dfb1 to your computer and use it in GitHub Desktop.
Save yusirdemir/0dd2fa7c7367d6cddeec3b08dad5dfb1 to your computer and use it in GitHub Desktop.
Snippets
{
"Singleton Lazy": {
"scope": "dart",
"prefix": "lazy",
"body": [
"class $1 {",
"static $1 _instace;",
"static $1 get instance {",
"if (_instace == null) _instace = $1._init();",
"return _instace;",
"}",
"$1._init();",
"}"
],
"description": "Lazy Singleton"
},
"Singleton Eager": {
"scope": "dart",
"prefix": "eager",
"body": [
"class $1 {",
"static $1 _instace = $1._init();",
"static $1 get instance => _instace;",
"$1._init();",
"}"
],
"description": "Eager Singleton"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment