Skip to main content
Refractor supports four build targets, each optimized for different deployment scenarios. All targets go through the same obfuscation pipeline, but produce different final output formats.

Available Targets

The Target enum defines four compilation targets:
enum Target {
  exe('exe', ''),
  aot('aot-snapshot', '.aot'),
  jit('jit-snapshot', '.jit'),
  kernel('kernel', '.dill')
}
Source: lib/src/engine/compiler/compiler.dart:6-11

Target Details

exe

Native executable with the Dart VM embedded. Self-contained and ready to run.

aot

AOT snapshot for pre-compiled native code. Fastest startup and execution.

jit

JIT snapshot with optimized bytecode. Requires Dart runtime to execute.

kernel

Raw kernel bytecode (.dill). Intermediate format for further processing.

Executable (exe)

File Extension: None (platform-specific executable) Use Cases:
  • Standalone CLI tools
  • Desktop applications
  • Production deployments where no Dart SDK is available
Build Command:
refractor build --target exe --output build
Characteristics:
  • Self-contained binary with embedded Dart VM
  • Largest file size (includes runtime)
  • No external dependencies
  • Platform-specific (Windows .exe, macOS/Linux binary)

AOT Snapshot (aot)

File Extension: .aot Use Cases:
  • Performance-critical applications
  • Server-side deployments
  • Mobile apps (Flutter)
  • Minimal startup time requirements
Build Command:
refractor build --target aot --output build
Characteristics:
  • Pre-compiled to native machine code
  • Fastest execution and startup
  • Requires dartaotruntime to execute
  • Smaller than exe, larger than JIT
  • Best runtime performance

JIT Snapshot (jit)

File Extension: .jit Use Cases:
  • Development and testing
  • Applications with dynamic code patterns
  • Scenarios where AOT restrictions apply
Build Command:
refractor build --target jit --output build
Characteristics:
  • Optimized bytecode with type feedback
  • Requires full Dart VM to execute
  • Smaller file size than AOT
  • Slower startup than AOT
  • Supports dynamic features better than AOT

Kernel (kernel)

File Extension: .dill Use Cases:
  • Inspecting obfuscated bytecode
  • Further processing or analysis
  • Integration with custom tooling
  • Debugging obfuscation passes
Build Command:
refractor build --target kernel --output build
Characteristics:
  • Raw Dart kernel intermediate representation
  • Can be inspected with refractor inspect
  • Smallest file size
  • Not directly executable
  • Platform-independent

Build Pipeline

All targets follow the same obfuscation pipeline:
1

Compile to Kernel

Source code is compiled to intermediate .dill format:
compiler.compileToKernel(request.input, dillPath);
2

Run Obfuscation Passes

Enabled passes (rename, string_encrypt, dead_code) transform the kernel:
final (obfuscated, symbolTable) = runner.run(component, config.toOptions());
3

Compile to Target

For exe/aot/jit, the obfuscated kernel is compiled to the final format:
compiler.compileToTarget(obfuscatedDillPath, request.output, request.target);
For kernel target, the obfuscated .dill is written directly:
kernelIO.write(obfuscated, request.output);
Source: lib/src/engine/engine.dart:39-85

Performance Comparison

TargetFile SizeStartup TimeRuntime PerformanceDeployment
exeLargestFastVery FastEasiest
aotLargeFastestFastestRequires runtime
jitMediumMediumFastRequires VM
kernelSmallestN/AN/ANot executable

Choosing the Right Target

Choose exe when:
  • You need a single file with no dependencies
  • Distributing to users without Dart SDK
  • Building CLI tools or standalone apps
  • File size is not a critical constraint
Choose aot when:
  • Performance is the top priority
  • You’re deploying to servers with dartaotruntime
  • Building Flutter mobile apps
  • You need the fastest possible startup
Choose jit when:
  • You need dynamic code features
  • File size matters more than startup time
  • Deploying to environments with Dart VM
  • AOT compilation limitations are blocking
Choose kernel when:
  • Inspecting obfuscation results
  • Building custom tooling
  • Debugging pass behavior
  • You need platform-independent bytecode

Inspecting Kernel Output

You can inspect any .dill file (including intermediate and final kernel targets) using:
refractor inspect build/app.dill
This prints a tree representation of the kernel structure, useful for verifying obfuscation.
Use --sdk flag to include Dart standard library internals:
refractor inspect --sdk build/app.dill

Target Selection Examples

refractor build
# Outputs: build/app (or build/app.exe on Windows)
The kernel target produces a .dill file that is not directly executable. It must be run through dart or compiled to another target format.

Next Steps

Configuration

Configure obfuscation passes and settings

Debugging

Learn to debug obfuscated builds with symbol maps

Build docs developers (and LLMs) love