[英]VS Code (Flutter, dart) error don't go away after commenting or deleting code
我正在使用 Mac OS Catalina (10.15.3) 這是我的代碼。
dart
顯示錯誤Only static members can be accessed in initializers
就是這樣。 錯誤不會 go 消失。 即使評論一切都刪除一切 dart 繼續給出該錯誤。 我不明白。 在Android Studio
工作。 完全相同的。 我以為是Android Studio
問題。 因此,我再次下載了VS Code
。 這是我評論行后的錯誤照片。
請幫我。 它讓我很煩。 我不知道該怎么辦。
編輯1:我可以重現這個問題。 假設我有一些StateLessWidget
class
class SearchPage extends StatelessWidget {
// Whenever I try to write property beginning with type Future
Future<... // <--- Android Studio and VS Code both stop working.
// then it starts working when I restart
@override
Widget build(BuildContext context) {
return Container();
}
}
那你做什么都沒關系。 在重新啟動之前沒有任何效果。
您可以嘗試以下幾件事:
更新 VS 代碼。
flutter doctor -v
是否包含任何錯誤消息?
嘗試運行flutter clean
打開 pubspec.yaml,右鍵單擊並“獲取包”。
移動到另一個通道(例如flutter channel beta
)並運行flutter upgrade
刪除並重新安裝 Flutter 及其 IDE 擴展
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.