Dart 省道';函数为';t定义为';尽管定义明确

Dart 省道';函数为';t定义为';尽管定义明确,dart,flutter,Dart,Flutter,如何正确访问onTap()中的运行此函数(…) 。。。 类_DealList使用AutomaticEpaLiveClientMixin扩展状态{ void\u runThisFunction()异步{ 打印(‘运行我’) } @凌驾 小部件构建(构建上下文){ super.build(上下文); 回归未来建设者( 未来:_loadingDeals, 生成器:(BuildContext上下文,异步快照){ 返回snapshot.connectionState==connectionState.do

如何正确访问
onTap()中的
运行此函数(…)

。。。
类_DealList使用AutomaticEpaLiveClientMixin扩展状态{
void\u runThisFunction()异步{
打印(‘运行我’)
}
@凌驾
小部件构建(构建上下文){
super.build(上下文);
回归未来建设者(
未来:_loadingDeals,
生成器:(BuildContext上下文,异步快照){
返回snapshot.connectionState==connectionState.done
?刷新指示器(
onRefresh:_handleRefresh,
子项:ListView.builder(
物理:常量AlwaysScrollablePhysics(),
itemCount:snapshot.data['deals'].length,
itemBuilder:(上下文,索引){
最终地图交易=快照.data['deals'][index];
return _getDealItem(交易,上下文);
},
),
)
:中心(
子对象:CircularProgressIndicator(),
);
},
);
}
}
容器_getDealItem(映射交易、上下文){
退回新货柜(
身高:90.0,
儿童:材料(
孩子:InkWell(

child:_getDealRow(deal),//原因是您超出了范围。
小提示:单词“function”总是表示您尝试调用的函数不是类的一部分,关键字“method”表示您尝试调用的函数是类的一部分

在您的情况下,
\u运行此函数
是在
\u交易列表
中定义的,但您试图从外部调用它。
您需要将
\u getDealItem
移动到
\u DealList
\u运行此函数

/// In this case both methods [_runThisFunction()] and [_getDealItem()] are defined inside [_DealList].
class _DealList extends State<DealList> with AutomaticKeepAliveClientMixin {
   void _runThisFunction() ...

   Container _getDealItem() ...
}

您需要确保对
\u getdealow
和其他嵌套调用应用相同的逻辑。

您确定吗?似乎这不是您的实际情况,因为缺少分号。是的,到处都有语法错误。缺少逗号,缺少分号。param声明在哪里?等等。我无法回答没有所有的代码。@CreativeCreatorMorMaybeno不缺少分号?让我尝试提供一个更好的代码snippet@creativecreatorormaybenot添加了更多代码来解释该过程
/// In this case both methods [_runThisFunction()] and [_getDealItem()] are defined inside [_DealList].
class _DealList extends State<DealList> with AutomaticKeepAliveClientMixin {
   void _runThisFunction() ...

   Container _getDealItem() ...
}
/// In this case both functions are defined globally.
void _runThisFunction() ...

Container _getDealItem() ...