Flutter 参数不匹配的闭包调用:函数
我试图在按下按钮时显示一个警报对话框,但由于某种原因,我得到了这个错误。我对另一个小部件使用相同的代码,它会毫无问题地显示出来,我不知道为什么它不工作Flutter 参数不匹配的闭包调用:函数,flutter,dart,Flutter,Dart,我试图在按下按钮时显示一个警报对话框,但由于某种原因,我得到了这个错误。我对另一个小部件使用相同的代码,它会毫无问题地显示出来,我不知道为什么它不工作 IconButton( icon: Icon(Icons.delete), color: Colors.red[400], onPressed: () => showDialog(
IconButton(
icon: Icon(Icons.delete),
color: Colors.red[400],
onPressed: () => showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
'DELETE?'.toUpperCase(),
),
actions: [
TextButton(
onPressed: (){},
child: Text("Yes"),
),
TextButton(
onPressed: (){},
child: Text("No"),
),
],
),
),
),
这就是我得到的:
Closure call with mismatched arguments: function '_HomeScreenState.getWalletsItemsFromDb.<anonymous closure>.<anonymous closure>'
Receiver: Closure: () => void
Tried calling: _HomeScreenState.getWalletsItemsFromDb.<anonymous closure>.<anonymous closure>(builder: Closure: (dynamic) => AlertDialog, context: Instance of 'StatelessElement')
Found: _HomeScreenState.getWalletsItemsFromDb.<anonymous closure>.<anonymous closure>() => void
参数不匹配的闭包调用:函数“\u homescrenstate.getWalletsItemsFromDb..”
接收人:关闭:()=>无效
尝试调用:_homescrenstate.getWalletsItemsFromDb..(生成器:Closure:(dynamic)=>AlertDialog,上下文:无状态元素的实例)
找到:_homescrenstate.getWalletsItemsFromDb..()=>void