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
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.
Works with
Packages commonly used together with stack_trace: ones it builds on, ones built on it, and its own family.
- poolBuilt on stack_traceManage a finite pool of resources to control concurrent operations.
- coverageBuilt on stack_traceCollects, manipulates, and formats code coverage data in Dart
- test_apiBuilt on stack_traceThe user facing API for structuring Dart tests and checking expectations.
- shelfBuilt on stack_traceComposable web server middleware for Dart
- testBuilt on stack_traceA full featured library for writing and running Dart tests across platforms.
- matcherBuilt on stack_traceSupport for specifying test expectations via an extensible Matcher class.
- webdriverBuilt on stack_traceProvides WebDriver bindings for Dart to interact with a WebDriver remote server.
- source_map_stack_traceBuilt on stack_traceConverts dart2js-compiled JavaScript stack traces into readable native Dart stack traces.