I need to load AES encrypted Image from assets to memory and display it with Image.memory().
when I compile the code for windows it run without errors, but when I compile it for android emulator it give Source file does not exist path error.
String encFilepath = './assets/Question-2.png.aes';
Uint8List? img;
var crypt = AesCrypt();
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
Uint8List decryptFileToMemorySync(String encFilepath) {
Uint8List bytes = crypt.decryptDataFromFileSync(encFilepath);
Img.Image image = Img.decodeImage(bytes) as Img.Image;
Uint8List imagePng = Img.encodePng(image);
return imagePng;
}
@override
Widget build(BuildContext context) {
crypt.setPassword('WX5DgtHQ8OC4l0h9a jtvg5u7 fBSNYrc2gMhuAzOpg xZbrhFBQGYdnSLv4FeQ27myJbSh NFRhebA3kln2Tv');
crypt.setOverwriteMode(AesCryptOwMode.rename);
var x = decryptFileToMemorySync(encFilepath);
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(title),
),
body: Center(
child: FittedBox(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Decrypted Image:',
),
Image.memory(x, color: Colors.black),
],
),
),
),
);
}
}
on windows it run and display the image:
the same code on android it give error:
how can I get it to work for android?

