Flutter2.2中提示 The parameter 'key' can't have a value of 'null' because of its type

发布于 3 年前 作者 phonegap100 3931 次浏览 最后一次编辑是 3 年前 来自 分享

Flutter2.2中提示 The parameter ‘key’ can’t have a value of ‘null’ because of its type, but the implicit default value is ‘null’. Try adding either an explicit non-‘null’ default value or the ‘required’ 解决方案

22.jpg

解决办法:

实例化的时候把Key配置成可选参数

class PayPage extends StatefulWidget {
  PayPage({Key? key}) : super(key: key);

  _PayPageState createState() => _PayPageState();
}

3333.jpg

回到顶部