Skip to content

Commit

Permalink
stackTraceBeginIndex not working as expected (fixes simc#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-mf committed Jul 8, 2022
1 parent 7e510ec commit 2a5f462
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/src/printers/pretty_printer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ class PrettyPrinter extends LogPrinter {

String? formatStackTrace(StackTrace? stackTrace, int methodCount) {
var lines = stackTrace.toString().split('\n');
if (stackTraceBeginIndex > 0 && stackTraceBeginIndex < lines.length - 1) {
lines = lines.sublist(stackTraceBeginIndex);
}
var formatted = <String>[];
var count = 0;
for (var line in lines) {
Expand All @@ -162,6 +159,12 @@ class PrettyPrinter extends LogPrinter {
line.isEmpty) {
continue;
}

if(count < stackTraceBeginIndex) {
count++;
continue;
}

formatted.add('#$count ${line.replaceFirst(RegExp(r'#\d+\s+'), '')}');
if (++count == methodCount) {
break;
Expand Down

0 comments on commit 2a5f462

Please sign in to comment.