demangleStackTrace property Null safety
read / write
Called by the Flutter framework before attempting to parse a StackTrace.
Some StackTrace implementations have a different toString format from what the framework expects, like ones from package:stack_trace. To make sure we can still parse and filter mangled StackTraces, the framework first calls this function to demangle them.
This should be set in any environment that could propagate a non-standard stack trace to the framework. Otherwise, the default behavior is to assume all stack traces are in a standard format.
The following example demangles package:stack_trace traces by converting them into vm traces, which the framework is able to parse:
FlutterError.demangleStackTrace = (StackTrace stackTrace) {
if (stack is stack_trace.Trace)
return stack.vmTrace;
if (stack is stack_trace.Chain)
return stack.toTrace().vmTrace;
return stack;
};
Implementation
static StackTraceDemangler demangleStackTrace = _defaultStackTraceDemangler;