void main() async {
int myDelay = 5;
print('Hello');
var value = await _customDelay(myDelay);
var customText = myDelay == 1 ? "second later" : "seconds later";
print('Its $value $customText');
}
Future<int> _customDelay(int delay) async {
try {
await Future.delayed(Duration(seconds: delay));
return delay;
} catch (e) {
print(e);
return delay;
}
}
它不显示在调试控制台或在我的输出,我已经找到了我的文件夹,但仍然不工作
1条答案
按热度按时间qij5mzcb1#
试试这个: