当我将参数传递给这样的函数时:
Future<APITestObj>_testFunction(string acctNum, id) async {
APITestObj testObjec = await ApiHelper.wrapper(context () => this.api.APITestObj(acctNum, id);
return testObject;
}
,然后从这样的按钮函数内部调用函数:
onTap() {
_testFunction(13, 9);
}
该函数未执行。有人可以解释为什么吗?
错误消息示例:enter image description here
答案 0 :(得分:0)
_testFunction
返回一个Future,所以您应该更改
onTap() {
_testFunction(13, 9);
}
对此:
onTap() async {
var result = await _testFunction(13, 9);
print('$result')
}