对于第一个flutter sdk可用的flutter项目,MaterialApp flutter小部件给出错误“期望1个必需参数,但找到0个”。我在VScode上运行它。这是代码。预先感谢。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp( // This line is giving Error at'('
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
答案 0 :(得分:0)
我使用VSCode遇到了完全相同的问题,发现此问题可以解决此问题:
在Flutter安装目录中运行以下命令:
https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted