Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fundasarikaya/4a9e766ccac113a8d1571b9552e9e773 to your computer and use it in GitHub Desktop.
Save fundasarikaya/4a9e766ccac113a8d1571b9552e9e773 to your computer and use it in GitHub Desktop.
CoderFunda Flutter Snippet
{
"Magic number": {
"scope": "dart",
"prefix": "#MagicNumber",
"body":"static const $1=$2",
"description": "CoderFunda Magic Number Create"
},
"Singleton Eager": {
"scope": "dart",
"prefix": "#SingletonEager",
"body":[
"class $1{",
"static $1 _instance;",
"static $1 get instance {",
"if(_instance == null) _instance = $1._init();",
"return _instance;",
"}",
"$1._init();",
"}"
],
"description": "CoderFunda Singleton Eager Create"
},
"Base View Model": {
"scope": "dart",
"prefix": "#BaseViewModel",
"body":[
"void setContext(BuildContext context) =>this.context = context;",
"void init(){}"
],
"description": "CoderFunda Singleton Eager Create"
}
,
"Base View": {
"scope": "dart",
"prefix": "#BaseView",
"body":[
"BaseView<$1>(",
"viewModel:$1(),",
"onModelReady: (model){",
" model.setContext(context);",
"},",
"onPageBuilder: (BuildContext context, $1 value) => Scaffold(),",
");"
],
"description": "CoderFunda Singleton Eager Create"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment