Usually stack traces that occur in asynchronous operations are cut off at the first await (asynchronous suspension).
So, I am using Chain.capture to get full traces.
Chain.capture(() {
runApp(rootWidget);
}, onError: (dynamic error, dynamic stackTrace) {
reportError(error, stackTrace);
});
However, it looks like Flutter doesn't like it and sometimes throws:
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 ===========================''
How can I fix that?