导航器推送需要键吗?

  • 本文关键字:导航 flutter
  • 更新时间 :
  • 英文 :


在升级之前这段代码工作得很好:代码现在带有和错误

现在这个不工作,并出现这个错误:eror描述

代码如下:code1code2请帮助。

class Productos extends StatefulWidget {
//You can delete this line below and the problem will be solved
Productos({required Key key}) : super(key: key); //<--this line
@override
_ProductosState createState() => _ProductosState();
}

但是,在删除它之前,请再次检查是否需要这一行。在产品界面时按ctrl + f。输入并搜索"widget.key"。如果没有,则删除该行。

不,导航器不需要键。但是看看你们的产品。在Productos的类构造函数中,你有一个' required ';关键字

最新更新