-
Notifications
You must be signed in to change notification settings - Fork 5
Assets
Efra Espada edited this page Apr 27, 2021
·
9 revisions
Stringcare can obfuscate your assets files. Include any asset file you need:
root
|
|_ assets
| |_ # obfuscated assets files
|
|_ assets_base
| |_ voyager.jpeg
|
|_ assets_test
|_ # test revealed assets files
stringcare:
assets:
obfuscated: "assets" # obfuscated assets path
original: "assets_base" # original assets path
test: "assets_test" # test reveal assets path (only needed for testing)
resources:
class_name: "R" # R class for accessing resources
class_dir: "lib" # R class directory
flutter:
assets:
- assets/voyager.jpegRun this command to generate the obfuscated assets files:
flutter pub run stringcare:obfuscate Once the obfuscated assets files are generated, you can test the reveal:
flutter pub run stringcare:revealSample revealing image assets:
import 'package:stringcare/stringcare.dart';
import 'r.dart';
Uint8List image;
@override
void initState() {
super.initState();
initImageState();
}
void initImageState() async {
var data = await Stringcare.revealAsset(R.assets.images_voyager_jpeg);
setState(() {
image = data;
});
}Load the image when Uint8List is ready:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
padding: EdgeInsets.all(15),
child: Column(
children: [
if (image != null)
Image(
width: 400,
height: 400,
image: MemoryImage(image),
fit: BoxFit.fitHeight),
],
),
),
);
}