首页 > 其他 > 详细

Flutter命名路由报错-Closure call with mismatched arguments:function 'routes.<anonymous closure>'

时间:2020-06-21 21:00:16      阅读:433      评论:0      收藏:0      [点我收藏+]

【报错描述】

技术分享图片

Closure call with mismatched arguments: function ‘routes.<anonymous closure>‘
Receiver: Closure: (dynamic) => ProductPage
Tried calling: routes.<anonymous closure>(Instance of ‘StatelessElement‘, arguments: null)
Found: routes.<anonymous closure>(dynamic) => ProductPage

//将跳转的页面
class ProductPage extends StatefulWidget { }

 

futter 版本

Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18362.900], locale zh-CN)
    • Flutter version 1.17.1 at D:\Programs\flutter
    • Framework revision f7a6a7906b (6 weeks ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2

 

【解决方案】

routes必须要带上参数,否则会报错,如下所示:

final routes = {
"/":(content,{arguments}) => Tabs(),
"/form":(content, {arguments}) => FormPage(),
"/order":(content, {arguments}) => OrderPage(),
"/product":(content, {arguments}) => ProductPage(),
"/search":(content,{arguments}) => SearchPage(arguments:arguments),
};

 

Flutter命名路由报错-Closure call with mismatched arguments:function 'routes.<anonymous closure>'

原文:https://www.cnblogs.com/liuyp-ken/p/13173652.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!