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_Callback - Fatal编程技术网

Flutter 在颤振文档中,这个参数传递给这个回调函数的位置在哪里?

Flutter 在颤振文档中,这个参数传递给这个回调函数的位置在哪里?,flutter,dart,callback,Flutter,Dart,Callback,myTapCallback()的参数在哪里/如何传递给MyListItem(myTapCallback)调用 @override Widget build(BuildContext context) { return SomeWidget( // Construct the widget, passing it a reference to the method above. MyListItem(myTapCallback), //<—- where is

myTapCallback()
的参数在哪里/如何传递给
MyListItem(myTapCallback)
调用

    @override
Widget build(BuildContext context) {
  return SomeWidget(
    // Construct the widget, passing it a reference to the method above.
    MyListItem(myTapCallback),  //<—- where is item?
  );
}

void myTapCallback(Item item) {
  print('user tapped on $item');
}
@覆盖
小部件构建(构建上下文){
返回SomeWidget(
//构造小部件,向其传递对上述方法的引用。

MyListItem(myTapCallback),//从代码和教程中可以看出,代码似乎正在构造MyListItem并将回调传递到构造函数中。MyListItem可能会在点击时在内部使用回调,并将项传递到回调中。从代码和教程中可以看出,代码似乎正在构造MyListItem和pa在构造函数中使用回调。MyListItem可能会在点击回调时在内部使用回调,并将项传递到回调中

MyListItem
是一个接受
函数(项)的函数
作为参数。您没有传递
MyListItem
的参数项,该项将由
MyListItem
内部提供。它唯一需要作为参数的是一个函数,该函数将项项作为参数。

MyListItem
是一个函数,它将
函数(项项项项)作为参数
作为参数。您没有传递
MyListItem
的参数项,该项将由
MyListItem
内部提供。作为参数,它唯一需要的是一个函数,该函数将项作为参数