try {
//CheckPermission
if (await Permission.storage
.request()
.isGranted) {
final result = await SaveImageToKoi(post.fimgUrl!.url!);
print(result);
if (result != null)
BotToast.showText(text: "Success");
else
BotToast.showText(text: "Error");
}
} catch (e) {}
},
dynamic SaveImageToKoi (koi_url) async {
print(koi_url);
var response = await Dio().get(
koi_url,
options: Options(responseType: ResponseType.bytes));
final result = await ImageGallerySaver.saveImage(
Uint8List.fromList(response.data),
quality: 100);
}
I am trying to use the below library: https://pub.dev/packages/image_gallery_saver
And when I am saving picture, it will cause the UI thread to get stuck. The stuck time depends on the size of the image An error will be reported when trying to create a new thread by using compute to save. I don't know how to solve it, I just started learning Flutter and hope to receive
I guess the plug-in was written by Kotlin, and there was a problem when the interface communication was created by Dart
Thanks.
This is an error when I use compute
In platform_channal.dart
Thrown by
BinaryMessenger get binaryMessenger => _binaryMessenger ??
ServicesBinding.instance!.defaultBinaryMessenger;
exception = {_CastError} Null check operator used on a null value