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

发布于 4 个月前 作者 phonegap100 780 次浏览 最后一次编辑是 4 个月前 来自 分享

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

回到顶部