TraceMapping class final

A structured representation of a complete stack trace with analysis capabilities.

This class wraps a collection of TraceFrame instances and provides comprehensive methods for stack trace analysis, filtering, and navigation. It enables sophisticated stack trace processing for debugging, logging, and diagnostic scenarios in Jetleaf applications.

TraceMapping supports common stack trace operations such as caller identification, frame filtering by package or method, and hierarchical navigation through the call stack. It serves as the foundation for Jetleaf's advanced diagnostic and monitoring features.

Example

void inspectStack() {
  final stackTrace = StackTrace.current;
  final mapping = TraceMapping.fromStackTrace(stackTrace);

  print('Top frame: ${mapping.frameAt(0)}');
  print('Caller: ${mapping.getCallingMethod()}');
  print('All frames:\n${mapping}');
}

This class is part of Jetleaf’s reflective trace analysis subsystem, supporting introspection of AOP proxies, runtime weaving, and advanced diagnostic features.

Constructors

TraceMapping(List<TraceFrame> _frames)
A structured representation of a complete stack trace with analysis capabilities.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

findByMethodName(String methodName) → TraceFrame?
Finds the first frame with the specified method name.
frameAt(int index) → TraceFrame?
Retrieves the stack frame at the specified hierarchical index.
getAllFrames() → List<TraceFrame>
Retrieves all frames in this trace mapping as an unmodifiable list.
getCallingMethod() → TraceFrame?
Retrieves the frame representing the immediate caller of the current method.
getFramesFromPackage(String package) → List<TraceFrame>
Retrieves all frames originating from the specified package.
isEmpty() → bool
Determines whether this trace mapping contains any frames.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
Returns a formatted string representation of the complete stack trace.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited