compressImageByXFileBase function
Implementation
Future<Uint8List> compressImageByXFileBase(XFile xfile, Options opts) async {
var completer = Completer<Uint8List>();
var file = File(
[await xfile.readAsBytes()],
xfile.name,
{'type': xfile.mimeType},
);
OptionsBase optionsBase = OptionsBase.fromOptions(opts);
var value =
await completerForPromise(imageCompression(file, optionsBase.impl))
.future;
var r = FileReader();
r.readAsArrayBuffer(value);
r.onLoadEnd.listen((data) {
completer.complete(r.result as Uint8List);
});
return completer.future;
}