Overview
TheSymbolTable class tracks the mapping from original identifiers to their obfuscated names. It’s useful for generating a symbol map that can be used to deobfuscate stack traces and debug obfuscated builds.
This class is pure (no dart:io dependencies in the core implementation). File writing is available via the writeToFile() method.
Constructor
Methods
record()
Records a rename mapping: the original identifier was renamed to the obfuscated identifier.The original identifier name (e.g.,
'MyClass', 'myMethod')The obfuscated identifier name (e.g.,
'_$0', '_$1')original()
Looks up the original name for an obfuscated identifier.The obfuscated identifier to look up
Returns the original name if found, or
null if the mapping doesn’t existobfuscated()
Looks up the obfuscated name for an original identifier (reverse lookup).The original identifier to look up
Returns the obfuscated name if found, or
null if the mapping doesn’t existThe
obfuscated() method performs a reverse lookup by iterating through all entries. For better performance on large symbol tables, use original() when possible.writeToFile()
Writes the symbol table to a JSON file on disk.File path where the JSON symbol map should be written. Parent directories are created automatically if they don’t exist.
toJson()
Exports the symbol table as an immutable JSON-encodable map.Unmodifiable map with obfuscated names as keys and original names as values
toJsonString()
Exports the symbol table as a pretty-printed JSON string.Pretty-printed JSON string with 2-space indentation
Properties
size
Returns the number of mappings in the symbol table.JSON Format
The symbol table is exported as a JSON object mapping obfuscated names to original names:The keys are the obfuscated names and the values are the original names. This format is optimized for fast lookups during stack trace deobfuscation.
Usage Example
Basic Usage
Writing to File
With PassRunner
Deobfuscating Stack Traces
Use the symbol table to deobfuscate stack traces from production builds:Symbol maps are especially valuable for:
- Debugging production crashes
- Analyzing performance profiles
- Understanding error reports from users
Related
PassRunner
Returns a SymbolTable after running passes
RefractorEngine
BuildResult includes the final SymbolTable