gpt4 book ai didi

dart - 支持 'Dart' 片段

转载 作者:IT王子 更新时间:2023-10-29 07:04:19 26 4
gpt4 key购买 nike

我想在 VS Code 中支持 Dart 片段。我也想使用 Snippet Creator ( https://github.com/nikitaKunevich/vscode-snippet-creator ) 之类的东西来这样做,但这似乎不起作用,因为“dart”不是语言选项。是否可以添加“dart”作为选项,以便我可以使用片段创建器在“*.dart”文件中添加片段?

最佳答案

control+shift+p >snippets > dart.json 添加这段代码

{
"stateless": {
"prefix": "fless",
"body": [
"import 'package:flutter/material.dart';",
"class $1 extends StatelessWidget {",
"\t@override",
"\tWidget build(BuildContext context) {",
"\t\treturn Container(",
"\t\t\t$2",
"\t\t);",
"\t}",
"}"
]
},

"stateful": {
"prefix": "ffull",
"body": [
"import 'package:flutter/material.dart';",
"class $1 extends StatefulWidget {",
"\t@override",
" \t_$1State createState() => _$1State();",
"}",

"class _$1State extends State<$1> {",
" \t@override",
" \tWidget build(BuildContext context) {",
"\t\treturn Container(",
" \t\t\t$2",
"\t\t);",
"\t}",
"} "
]
}

}//control+shift+p >snippets > dart.json 添加这段代码

关于dart - 支持 'Dart' 片段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54811769/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com