string_obfuscation 0.1.0
string_obfuscation: ^0.1.0 copied to clipboard
A build_runner generator that obfuscates Dart string literals at build time.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:string_obfuscation/string_obfuscation.dart';
part 'main.gen.dart';
@ClassEncrypt(encryptKey: 'example-key')
abstract class AppStrings {
@StringEncrypt(value: 'String obfuscation')
String get appTitle;
@StringEncrypt(value: 'Generated strings are ready to use.')
String get welcomeMessage;
String get startButton;
}
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text(appStrings.appTitle),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(appStrings.welcomeMessage),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {},
child: Text(appStrings.startButton),
),
],
),
),
),
);
}
}