Skip to main content

stealth_enum 1.0.5 copy "stealth_enum: ^1.0.5" to clipboard
stealth_enum: ^1.0.5 copied to clipboard

Obfuscates Dart enums into zero-cost extension types backed by high-entropy integers, eliminating enum metadata from Flutter AOT binaries.

example/example.dart

// ignore_for_file: unused_element, unused_field

import 'package:stealth_enum/stealth_enum.dart';

part 'example.g.dart';

/// 1. Define a private enum annotated with `@StealthEnum()`.
@StealthEnum()
enum _SubscriptionStatus {
  trial,
  active,
  expired,
  cancelled,
}

/// 2. Use the generated `SubscriptionStatus` extension type with zero runtime cost.
void main() {
  const status = SubscriptionStatus.active;

  // Exhaustive pattern matching (fully inlined at compile time):
  final message = status.when(
    trial: () => 'Enjoy your free trial!',
    active: () => 'Welcome back, active subscriber!',
    expired: () => 'Your subscription has expired.',
    cancelled: () => 'We hope to see you again.',
  );
  print(message);

  // Partial matching with required orElse fallback:
  final isPaid = status.maybeWhen(
    active: () => true,
    orElse: () => false,
  );
  print('Is paid user: $isPaid');

  // Direct integer representation check (zero heap allocation):
  print('Raw value: 0x${status.rawValue.toRadixString(16).toUpperCase()}');
}
10
likes
160
points
0
downloads

Documentation

API reference

Publisher

verified publisheraslamambiloly.2bd.net

Weekly Downloads

Obfuscates Dart enums into zero-cost extension types backed by high-entropy integers, eliminating enum metadata from Flutter AOT binaries.

Repository (GitHub)
View/report issues

Topics

#security #obfuscation #reverse-engineering #code-generation #anti-tamper

License

MIT (license)

Dependencies

meta

More

Packages that depend on stealth_enum