Skip to content
pubscout

stealth_enum

2.2.7, released 3 weeks ago by aslamambiloly.2bd.net

Obfuscates Dart enums into zero-cost extension types to eliminate metadata from binaries.

WASM-ready
$ flutter pub add stealth_enum
Source repository

What it does

Generates zero-overhead extension types from private enums using high-entropy integers. It removes enum names from compiled AOT binaries to protect against reverse engineering tools like Ghidra and Blutter.

AI-written summary of version 2.2.7, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to prevent reverse engineering of app enums and business logic constants.
  • You need pattern matching and safe parsing for obfuscated enum states.

Skip it when

  • You require traditional reflection or runtime metadata access on enums.
  • You do not use code generation tools in your development workflow.

Strengths

  • Removes enum identifier strings entirely from compiled AOT binaries.
  • Zero runtime overhead using extension types over primitive integers.
  • Compile-time exhaustiveness guarantees and safe parsing.

Weaknesses

  • Requires build_runner and code generation steps.
  • Enums must be defined privately with special annotations.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
1

Requires adding build_dev dependencies and running build_runner code generation.

import 'package:stealth_enum/stealth_enum.dart';

part 'security_clearance.g.dart';

@StealthEnum()
enum _SecurityClearance {
  guest,
  operator,
  admin,
  superAdmin,
}

Alternatives

Packages that do the same job and could replace stealth_enum.

Works with

Packages commonly used together with stealth_enum: ones it builds on, ones built on it, and its own family.