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

发布于 1周前 作者 phonegap100 最后一次编辑是 5天前 来自 分享

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


更多关于Flutter2.2中提示 The parameter 'key' can't have a value of 'null' because of its type的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html

回到顶部
AI 助手
你好,我是IT营的 AI 助手
您可以尝试点击下方的快捷入口开启体验!