VisualStudioCode VSD 集成Dart 采坑记录

1  代码不联想

VSD配置Dart都成功以后,直接新建一个 .dart 文件,结果代码不联想,瞬间感觉不好了

有一个警告:For full Dart language support, please open a folder containing your Dart files instead of individual loose files

好吧,原来是直接新建一个 .dart 文件进行编辑不支持,需要新建一个文件夹,再在里面新建  .dart文件就可以了

就是打开随便哪个盘,新建一个文件夹,用VSD打开,再新建  .dart文件就可以了

2 assert不执行 及调试模式啥意思

assert说在调试模式下才会执行,调试模式啥意思呢,就是你debug就是调试模式

VisualStudioCode怎么debug呢: 运行 —> 调试  

然后报错: Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file.

就是说在 .vscode下面有一个 launch.json 的文件,文件里面program对应的东西找不到

然后就OK 了。

debug模式下,assert就会执行,如果返回false会直接报错

3 with 报错  

错误:The class 'B' can't be used as a mixin because it declares a constructor.dart(mixin_class_declares_constructor)

class A{

    A(){
            
         }    



}

class B with A{
    
    //  此时会报错:
    //  The class 'B' can't be used as a mixin because it declares a         
    //  constructor.dart(mixin_class_declares_constructor)
    //  就是 说A无法作为一个mixin 因为他有构造函数
    // 把类A 里面的构造函数删除 就可以了

}

猜你喜欢

转载自blog.csdn.net/u011288271/article/details/106047133
VSD