Skip to content
pubscout

stack_trace

1.12.2, released 3 months ago by tools.dart.dev

Provides parsing, inspection, and readable formatting of Dart stack traces.

WASM-readyRock solid
$ flutter pub add stack_trace
Source repository

What it does

The package can convert native StackTrace objects into Trace objects, format them into human‑readable strings, and capture asynchronous stack chains. It also offers utilities like terse formatting to collapse core library frames.

AI-written summary of version 1.12.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need clearer error logs during development or production debugging
  • You want to track asynchronous call stacks across zones
  • You need to format stack traces for reporting or logging

Skip it when

  • You only need simple stack traces and want to avoid extra dependencies
  • Your app size constraints are extremely tight and you cannot afford any extra package

Strengths

  • Produces concise, readable stack traces
  • Supports asynchronous stack chain capture
  • Works on all Dart platforms
  • No code generation required

Weaknesses

  • Adds runtime overhead when capturing chains
  • Limited to stack‑trace manipulation; not a full logging solution

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:stack_trace/stack_trace.dart';

void main() {
  try {
    throw 'error';
  } catch (e, st) {
    print(Trace.from(st)); // human‑readable stack trace
  }
}

Alternatives

Packages that do the same job and could replace stack_trace.

  • logging

    Provides general logging facilities but lacks stack‑trace parsing and chain features

Works with

Packages commonly used together with stack_trace: ones it builds on, ones built on it, and its own family.