StackFrame class Null safety

A object representation of a frame from a stack trace.

This example creates a traversable list of parsed StackFrame objects from the current StackTrace.
final List<StackFrame> currentFrames = StackFrame.fromStackTrace(StackTrace.current);

Annotations

Constructors

StackFrame({required int number, required int column, required int line, required String packageScheme, required String package, required String packagePath, String className = '', required String method, bool isConstructor = false, required String source})
Creates a new StackFrame instance.
const

Properties

className String
The class name, if any, for this frame.
final
column int
The source column number.
final
hashCode int
The hash code for this object.
read-only, override
isConstructor bool
Whether or not this was thrown from a constructor.
final
line int
The source line number.
final
method String
The method name for this frame.
final
number int
The zero-indexed frame number.
final
package String
The package for this frame, e.g. "core" for dart:core/errors_patch.dart or "flutter" for package:flutter/src/widgets/text.dart.
final
packagePath String
The path of the file for this frame, e.g. "errors_patch.dart" for dart:core/errors_patch.dart or "src/widgets/text.dart" for package:flutter/src/widgets/text.dart.
final
packageScheme String
The scheme of the package for this frame, e.g. "dart" for dart:core/errors_patch.dart or "package" for package:flutter/src/widgets/text.dart.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
source String
The original source of this stack frame.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

fromStackString(String stack) List<StackFrame>
Parses a list of StackFrames from the StackTrace.toString method.
fromStackTrace(StackTrace stack) List<StackFrame>
Parses a list of StackFrames from a StackTrace object.
fromStackTraceLine(String line) StackFrame?
Parses a single StackFrame from a single line of a StackTrace.

Constants

asynchronousSuspension → const StackFrame
A stack frame representing an asynchronous suspension.
StackFrame(number: -1, column: -1, line: -1, method: 'asynchronous suspension', packageScheme: '', package: '', packagePath: '', source: '<asynchronous suspensio…
stackOverFlowElision → const StackFrame
A stack frame representing a Dart elided stack overflow frame.
StackFrame(number: -1, column: -1, line: -1, method: '...', packageScheme: '', package: '', packagePath: '', source: '...')