Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 导航器需要按键吗?_Flutter - Fatal编程技术网

Flutter 导航器需要按键吗?

Flutter 导航器需要按键吗?,flutter,Flutter,在升级之前,此代码工作正常: 现在,这不起作用,并出现以下错误: 代码如下: 请帮忙。不,导航器不需要钥匙。但是在productos类构造函数中查看productos.dart,您有一个“必需”关键字类productos extends StatefulWidget{ //您可以删除下面的这一行,问题将得到解决 Productos({required Key}):super(Key:Key);//_ProductosState(); } 但是,在删除它之前,请再次检查是否需要此行。在pro

在升级之前,此代码工作正常:

现在,这不起作用,并出现以下错误:

代码如下:
请帮忙。

不,导航器不需要钥匙。但是在productos类构造函数中查看productos.dart,您有一个“必需”关键字

类productos extends StatefulWidget{
//您可以删除下面的这一行,问题将得到解决
Productos({required Key}):super(Key:Key);//_ProductosState();
}

但是,在删除它之前,请再次检查是否需要此行。在productos.dart上按ctrl+f并搜索“widget.key”。如果没有,您可以安全地删除该行。

您能给出productos代码的截图吗?所有119行代码?不是很漂亮,但是如果你问错误,没有,当我尝试使用navigator push@Adithaz50代码时,同样的错误是好的,我想我编辑了ask@Adithaz请学习如何在你的帖子中嵌入代码,而不是提供屏幕截图。你是对的,谢谢
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();
}