TraceFrame class final
Represents a single structured entry in a JetLeaf stack trace.
A TraceFrame models an individual call frame captured during runtime introspection, such as when an exception occurs or when JetLeaf’s reflective AOP layer is used to trace execution.
Represents a single frame in a stack trace with structured parsing and analysis.
This class provides a structured representation of stack trace frames with comprehensive metadata extraction and analysis capabilities. It parses raw stack trace lines into meaningful components (class, method, package URI, line numbers) and provides utility methods for frame analysis and filtering.
TraceFrame is essential for JetLeaf's diagnostic, logging, and debugging infrastructure, enabling sophisticated stack trace analysis and presentation across different execution environments and stack trace formats.
Each frame contains structured metadata extracted from the raw Dart stack trace, including:
- Hierarchical depth within the call stack.
- The class and method context of the call.
- Source file location (package URI, line, column).
- Original raw text of the trace line.
This class is an essential part of JetLeaf’s runtime diagnostics and reflection facilities. It allows accurate mapping between user code, proxy-generated calls, and framework-level interceptors.
Example
final frame = TraceFrame(
hierarchy: 2,
className: 'MyService',
methodName: 'processRequest',
packageUri: 'package:example/service.dart',
lineNumber: 45,
column: 12,
raw: '#2 MyService.processRequest (package:example/service.dart:45:12)',
);
print(frame);
// #2 MyService.processRequest (package:example/service.dart:45:12)
Constructors
- TraceFrame({required int hierarchy, String? className, String? methodName, required String packageUri, required int lineNumber, required int column, required String raw})
-
Represents a single structured entry in a JetLeaf stack trace.
const
- TraceFrame.empty(String raw)
-
Creates an empty TraceFrame from raw stack trace text.
const
Properties
- column → int
-
The column number in the source file where this frame was executing.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hierarchy → int
-
The hierarchical position of this frame in the stack trace.
final
- lineNumber → int
-
The line number in the source file where this frame was executing.
final
- packageUri → String
-
The package URI or file path containing this stack frame.
final
- raw → String
-
The raw text of the stack trace line that was parsed to create this frame.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getClassName(
) → String? - Retrieves the class name for this stack frame, if available.
-
getFileName(
) → String? - Extracts the base filename from the package URI without package prefix.
-
getMethodName(
) → String? - Retrieves the method name for this stack frame, if available.
-
isTopLevelFunction(
) → bool - Determines whether this frame represents a top-level function.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a formatted string representation of this stack frame.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited