Skip to content

Instantly share code, notes, and snippets.

@VB10
Created July 7, 2020 00:33
Show Gist options
  • Save VB10/aa6b604b5be3500b3dbf2d45990fd2ee to your computer and use it in GitHub Desktop.
Save VB10/aa6b604b5be3500b3dbf2d45990fd2ee to your computer and use it in GitHub Desktop.
HWA FLUTTER SNIPPET
{
"Magic number": {
"scope": "dart",
"prefix": "hwaMagicNumber",
"body": "static const $1 = $2;",
"description": "Hwa Magic Number Create"
},
"SIngleton Eager": {
"scope": "dart",
"prefix": "hwaEager",
"body": [
"class $1 {",
"static $1 _instace;",
"static $1 get instance {",
"if (_instace == null) _instace = $1._init();",
"return _instace;",
"}",
"$1._init();",
"}"
],
"description": "Hwa Magic Number Create"
},
"Base View Model": {
"scope": "dart",
"prefix": "hwaBaseViewModel",
"body": [
"void setContext(BuildContext context) => this.context = context;",
"void init() {}"
]
},
"Base View ": {
"scope": "dart",
"prefix": "hwaBaseView",
"body": [
"BaseView<$1>(",
"viewModel: $1(),",
"onModelReady: (model) {",
" model.setContext(context);",
"},",
"onPageBuilder: (BuildContext context,$1 value) => Scaffold(),",
");"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment