source_map_stack_trace
2.1.2, released 2 years ago by tools.dart.dev
Converts dart2js-compiled JavaScript stack traces into readable native Dart stack traces.
WASM-readyQuiet but busy
What it does
It maps obfuscated or minified JavaScript stack traces generated by dart2js back to the original Dart source code and line numbers using source maps. This makes debugging web apps compiled from Dart much easier.
AI-written summary of version 2.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are debugging a Flutter or Dart web application compiled with dart2js.
- You need to translate JS stack traces to original Dart files and line numbers.
Skip it when
- You are working exclusively on mobile or desktop native targets where dart2js is not used.
- You do not have access to the source maps generated during compilation.
Strengths
- Seamlessly converts cryptic JS stack traces into readable Dart ones.
- Handles mapping for package URIs and dart: SDK libraries.
Weaknesses
- Requires proper source maps to be generated and provided alongside the stack trace.
- Limited utility outside of Dart web environments.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
import 'package:source_map_stack_trace/source_map_stack_trace.dart';
void main() {
var jsTrace = // Get a StackTrace generated by dart2js.
var mapping = // Get a source map mapping the JS to the Dart source.
var dartTrace = mapStackTrace(jsTrace, sourceMap);
print(dartTrace);
}Alternatives
Packages that do the same job and could replace source_map_stack_trace.
- native_stack_traces
Decode non-symbolic stack traces from AOT-compiled Dart apps using stored debugging info
83Compare
Works with
Packages commonly used together with source_map_stack_trace: ones it builds on, ones built on it, and its own family.
- stack_tracesource_map_stack_trace depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- source_mapssource_map_stack_trace depends on itA Dart library to parse, build, and manipulate source map v3 files.
- poolSame familyManage a finite pool of resources to control concurrent operations.
- coverageSame familyCollects, manipulates, and formats code coverage data in Dart
- source_spanSame familyStandard representation for source code locations, spans, and human-friendly error messages.
- test_apiSame familyThe user facing API for structuring Dart tests and checking expectations.
- shelfSame familyComposable web server middleware for Dart
- dwdsSame familyProxies between the Chrome debug protocol and the Dart VM service protocol.