formatStackTrace method Null safety
- StackTrace stackTrace,
- {bool? verbose}
Converts stackTrace
to a Chain and formats it according to the user's
preferences.
If verbose
is true
, this doesn't fold out irrelevant stack frames. It
defaults to the current test's Metadata.verboseTrace configuration, or
false
if there is no current test.
Implementation
Chain formatStackTrace(StackTrace stackTrace, {bool? verbose}) {
verbose ??= Invoker.current?.liveTest.test.metadata.verboseTrace ?? false;
var chain =
Chain.forTrace(_mapper?.mapStackTrace(stackTrace) ?? stackTrace);
if (verbose) return chain;
return chain.foldFrames((frame) {
if (_only.isNotEmpty) return !_only.contains(frame.package);
return _except.contains(frame.package);
}, terse: true);
}