我有一个函数,它调用一个异步函数来从一个API返回一个响应,我需要将它存储在一个数组中。但是,当我查看数组的内容时,它没有API中的数据内容。function getDataArray() var arr = [];
.then(res => arr = res);
return arr; //call goes here without completing the result o
我想创建一个包含未来对象的异步函数。后者应该返回一个字符串,而函数应该返回将来返回的任何内容。我知道我不太擅长文字,但下面是代码和注释: Future<String> getData(int number) async { // here I created my async functionI want to assign the above function to a variable without executing it
Future<String>captureFun