通常,异步操作中发生的堆栈跟踪首先会被切断await(异步挂起)。
所以,我用来Chain.capture获取完整的痕迹。
Chain.capture(() {
runApp(rootWidget);
}, onError: (dynamic error, dynamic stackTrace) {
reportError(error, stackTrace);
});
Run Code Online (Sandbox Code Playgroud)
然而,Flutter 似乎不喜欢它,有时会抛出:
I/flutter ( 6384): The following assertion was thrown running a test (but after the test had completed):
I/flutter ( 6384): Got a stack frame from package:stack_trace, where a vm or web frame was expected. This can happen if
I/flutter ( 6384): FlutterError.demangleStackTrace was not set in an environment that propagates non-standard stack
I/flutter ( 6384): traces to the framework, such as during tests.
I/flutter ( 6384): 'package:flutter/src/foundation/stack_frame.dart':
I/flutter ( 6384): Failed assertion: line 194 pos 7: 'line != '===== asynchronous gap ===========================''
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
| 归档时间: |
|
| 查看次数: |
1139 次 |
| 最近记录: |