Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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_Dart - Fatal编程技术网

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