I am trying to covert a File to ByteData. It is working fine for iOS but showing error for Android.
It is showing below error:
Unable to load asset: /data/user/0/com.ABS.test_app/cache/image_picker8022762310279398302.jpg
Here is my code:
Future<Null> init() async {
try {
final ByteData data = await rootBundle.load(widget.fileImage.path);
image = await loadImage(Uint8List.view(data.buffer));
} catch (e) {
print('load image Error -- $e');
}
}
I found the solution :
Uint8List bytes = file.readAsBytesSync();
image = await loadImage(bytes);
I got reference from the URL