【发布时间】:2021-05-15 12:34:25
【问题描述】:
我的 Flutter 应用中有一行代码导致 VSCode 因异常而中断。
为了让这种行为发生,我在 vscode dart-code 扩展中启用了“中断未捕获的异常”。
观察下面的代码。带有 await 的行使 vscode 在“未捕获的异常”上中断,但该异常肯定被我捕获了。
vscode 如何在这一行的未捕获异常上中断,而该异常实际上随后被 runZoned 或 try/catch 捕获?
runZoned(
() async {
try {
if (_readCharSubscription != null)
await _readCharSubscription.cancel();
}
catch(e) {
print("caught");
}
},
onError: (e) {
print("caught");
}
);
【问题讨论】:
-
你应该在这里提出问题:github.com/Dart-Code/Dart-Code/issues
标签: flutter dart visual-studio-code