[英]1 positional argument(s) expected, but 0 found (Flutter)
通過教程學習 Bloc 並遇到了 1 個預期的位置參數,但 0 發現錯誤並且無法弄清楚錯誤的程度。
MaterialButton(
color: widget.color,
child: const Text(
'Go to Second Screen',
style: TextStyle(color: Colors.white),
),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SecondScreen(
title: 'Second Screen',
color: Colors.redAccent,
),
),
);
},
沒有什么會立即引起我的注意,但請嘗試使用導航器的以下語法:
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondScreen(
/* your args */
),
),
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.