merge method

StackTraceImpl merge(
  1. StackTrace microTask
)

merges two stack traces. Used when handling futures and you want combine a futures stack exception with the original calls stack

Implementation

StackTraceImpl merge(core.StackTrace microTask) {
  final _microImpl = StackTraceImpl.fromStackTrace(microTask);

  final merged = StackTraceImpl.fromStackTrace(this);

  var index = 0;
  for (final frame in _microImpl.frames) {
    // best we can do is exclude any files that are in the flutter src tree.
    if (isExcludedSource(frame)) {
      continue;
    }
    merged.frames.insert(index++, frame);
  }
  return merged;
}