Created
October 27, 2021 20:47
-
-
Save PlugFox/588639d45a7ed7aefdf04a1169166ad2 to your computer and use it in GitHub Desktop.
VSCode Dart/Flutter snippets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"New dartdoc template": { | |
"prefix": "newtmpl", | |
"body": [ | |
"/// {@template $TM_FILENAME_BASE.$1}", | |
"/// $0", | |
"/// {@endtemplate}" | |
], | |
"description": "Creates a new dartdoc template with current file's name as its prefix" | |
}, | |
"Dartdoc macro": { | |
"prefix": "usetmpl", | |
"body": "/// {@macro $TM_FILENAME_BASE.$0}", | |
"description": "Uses existing dartdoc macro with current file's name as its prefix" | |
}, | |
"Comment": { | |
"prefix": "cmnt", | |
"body": "// --- $1 --- //\n\n$0", | |
"description": "Comment block", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Config Mixin": { | |
"prefix": "cfg", | |
"body": [ | |
"mixin ${1:_Config} {", | |
" static const $2 = $0;", | |
"}" | |
], | |
"description": "Config mixin containing localized constants." | |
}, | |
"Config Mixin Entry": { | |
"prefix": "cfge", | |
"body": "static const $1 = $0;", | |
"description": "Static constant config mixin entry", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Arrow Stateless Widget" : { | |
"prefix": "stl", | |
"body": [ | |
"class $1 extends StatelessWidget {", | |
" $2", | |
"", | |
" const $1$3({Key? key,$0}) : super(key: key);", | |
"", | |
" @override", | |
" Widget build(BuildContext context) => $4;", | |
"}", | |
"", | |
], | |
"description": "Stateless Widget using arrow instead of return" | |
}, | |
"HOW": { | |
"prefix": "how", | |
"body": [ | |
"class $1 extends StatelessWidget {", | |
" final Widget child;", | |
" $2", | |
"", | |
" const $1$3({Key? key, required this.child, $0}) : super(key: key);", | |
"", | |
" @override", | |
" Widget build(BuildContext context) => $4;", | |
"}", | |
"", | |
], | |
"description": "Higher order widget that takes a child as an argument." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment