A command line utility to regenerate stack traces for minified Dart applications compiled with dart2js.
pub global activate retrace
retrace takes a source map file generated by dart2js and a minified stack trace. This is combined into a readable stack trace with original source code locations. For example:
bash$ dart2js someapp.dart
produces the following files
To run a retrace:
bash$ retrace someapp.dart.js.map Paste your minified trace here:
Now, paste the minified stack trace into the console. Add a blank line to get the resulting stack trace:
ArgumentError - foo is null at Error (native) at WK.X4 (http://www.someapp.com/someapp.dart.js:7106:31) at lx.R1 (http://www.someapp.com/someapp.dart.js:5358:5) ArgumentError - foo is null at Error (native) at web_audio/dart2js/web_audio_dart2js.dart:256 createBuffer (col 3) at someapp/base.dart:458 setupAudio (col 12)
More info #
Written by Björn Melinder. The source code can be found at https://github.com/bjornm/retrace - any pull requests and suggestions are more than welcome. Happy bug hunting :)
- Works on dart 2, thanks to spebbe for patch.
- Added support for parsing traces generated from the Trace class of the stack_trace dart package.
- Added --format option which accepts either a 'text' or 'json' argument. Text format, the default, prints the same as before. The json format pretty-prints a list of objects whith keys source, raw, line and column. Thanks to Danny Kirchmeier for this patch!
- Improved support for non-interactive use. The "Paste your minified trace here:" message is only printed if stdin is a terminal. The escape codes to colorize output are only printed if stdout is a terminal. Thanks to Matt Liberty for this patch!
- Bug fix; when program exited with an error code it was rerun by pub global activate wrapper script.
- Bug fix; pub global activate did not create the binary.
- Initial version.
Use this package as an executable
1. Install it
You can install the package from the command line:
$ pub global activate retrace
2. Use it
The package has the following executables:
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: retrace: ^1.2.0
2. Install it
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.0
- pana: 0.13.4
Health issues and suggestions
Document public APIs. (-0.14 points)
33 out of 34 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
lib/retrace.dart. (-6.78 points)
lib/retrace.dart reported 14 hints, including:
line 13 col 18: Unnecessary new keyword.
line 16 col 13: Unnecessary new keyword.
line 25 col 20: Unnecessary new keyword.
line 34 col 22: Unnecessary new keyword.
line 49 col 18: Unnecessary new keyword.
bin/retrace.dart. (-2.96 points)
bin/retrace.dart reported 6 hints, including:
line 9 col 16: Unnecessary new keyword.
line 31 col 20: Unnecessary new keyword.
line 32 col 38: 'TERMINAL' is deprecated and shouldn't be used. Use terminal instead.
line 33 col 7: DO use curly braces for all flow control structures.
line 40 col 22: Unnecessary new keyword.
The package description is too short. (-20 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
retrace.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.