Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions snippets/dart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"main": {
"prefix": "main",
"description": "Insert a main function, used as an entry point.",
"body": [
"void main(List<String> args) {",
" $0",
"}"
]
},
"try": {
"prefix": "try",
"description": "Insert a try/catch block.",
"body": [
"try {",
" $0",
"} catch (${1:e}) {",
"}"
]
},
"if": {
"prefix": "if",
"description": "Insert an if statement.",
"body": [
"if ($1) {",
" $0",
"}"
]
},
"if else": {
"prefix": "ife",
"description": "Insert an if statement with an else block.",
"body": [
"if ($1) {",
" $0",
"} else {",
"}"
]
},
"switch case": {
"prefix": "switch",
"description": "Insert a switch statement.",
"body": [
"switch ($1) {",
" case $2:",
" $0",
" break;",
" default:",
"}"
]
},
"for": {
"prefix": "for",
"description": "Insert a for loop.",
"body": [
"for (var i = 0; i < ${1:count}; i++) {",
" $0",
"}"
]
},
"for in": {
"prefix": "fori",
"description": "Insert a for-in loop.",
"body": [
"for (var ${1:item} in ${2:items}) {",
" $0",
"}"
]
},
"while": {
"prefix": "while",
"description": "Insert a while loop.",
"body": [
"while ($1) {",
" $0",
"}"
]
},
"do while": {
"prefix": "do",
"description": "Insert a do-while loop.",
"body": [
"do {",
" $0",
"} while ($1);"
]
},
"fun": {
"prefix": "fun",
"description": "Insert a function definition.",
"body": [
"${3:void} ${1:name}(${2:args}) {",
" $0",
"}"
]
},
"class": {
"prefix": "class",
"description": "Insert a class definition.",
"body": [
"class ${1:Name} {",
" $0",
"}"
]
},
"typedef": {
"prefix": "typedef",
"description": "Insert a typedef.",
"body": "typedef ${1:Type} ${2:Name}(${3:params});"
},
"test": {
"prefix": "test",
"description": "Insert a test block.",
"body": [
"test('$1', () {",
" $0",
"});"
]
},
"group": {
"prefix": "group",
"description": "Insert a test group block.",
"body": [
"group('$1', () {",
" $0",
"});"
]
}
}
69 changes: 69 additions & 0 deletions snippets/flutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"Flutter Stateless Widget": {
"prefix": "stless",
"description": "Insert a StatelessWidget",
"body": [
"class $1 extends StatelessWidget {",
" const $1({ super.key });",
"",
" @override",
" Widget build(BuildContext context) {",
" return ${0:const Placeholder()};",
" }",
"}"
]
},
"Flutter Stateful Widget": {
"prefix": "stful",
"description": "Insert a StatefulWidget",
"body": [
"class $1 extends StatefulWidget {",
" const $1({ super.key });",
"",
" @override",
" State<$1> createState() => _$1State();",
"}",
"",
"class _$1State extends State<$1> {",
" @override",
" Widget build(BuildContext context) {",
" return ${0:const Placeholder()};",
" }",
"}"
]
},
"Flutter Widget with AnimationController": {
"prefix": "stanim",
"description": "Insert a StatefulWidget with an AnimationController",
"body": [
"class $1 extends StatefulWidget {",
" const $1({ super.key });",
"",
" @override",
" State<$1> createState() => _$1State();",
"}",
"",
"class _$1State extends State<$1>",
" with SingleTickerProviderStateMixin {",
" late AnimationController _controller;",
"",
" @override",
" void initState() {",
" super.initState();",
" _controller = AnimationController(vsync: this);",
" }",
"",
" @override",
" void dispose() {",
" _controller.dispose();",
" super.dispose();",
" }",
"",
" @override",
" Widget build(BuildContext context) {",
" return ${0:const Placeholder()};",
" }",
"}"
]
}
}