AdityaMulgundkar / wallpaper_manager

A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper on Android devices.
https://pub.dev/packages/wallpaper_manager
MIT License
38 stars 31 forks source link

Use isolates to perform decoding #25

Open aarol opened 3 years ago

aarol commented 3 years ago

Currently the performance is not very good, because the image decoding is done on unefficiently here. The decoding happens on the main thread which hangs up the application. The solution to this is to run the decoding process in a separate isolate and sending the bytearray throught the method channel.

I have made a barebones example of this approach which uses very big images and the performance gain is noticeable, there are no frame drops on my emulator.

I'm hoping someone with more knowledge of the package could implement this.

edwinmacalopu commented 3 years ago

Yes, this implementation is necessary for very large images and does not block the application

Pavel401 commented 3 years ago

My application is lagging and frames are dropping constantly. How can I resolve this?

aarol commented 3 years ago

My application is lagging and frames are dropping constantly. How can I resolve this?

Are you using the code from the example? It should lag only for a small period probably due to memory being copied from the isolate.

PraveenGongada commented 3 years ago

My application is lagging and frames are dropping constantly. How can I resolve this?

https://pub.dev/packages/wallpaper_manager_flutter use this package

Use this package, there will be no lag even for 4k images, thanks to @aarol for the idea.

Pavel401 commented 3 years ago

Thanks @Praveen-0603 this package solved all my problems.