Flutter: App Stops Working Whit Image Gallery On Android

- 1 answer

enter image description here

I have this gallery built with CachedNetworkImage widgets and I uploaded some images from These images have good quality, so some of them are quite heavy.

Despite Flutter manages the images on an efficient way (when they are not presented on screen it doesn't display them) something weird happens.

As soon as I moved to the screen the app get closed and the phone's UI is reset. All the favourite icons I have at the bottom of the phone like contacts, whatsapp, etc. are disappeared and after a few seconds they start appearing again. Never saw this before with other apps.

I'm testing with the production version, not testing on my phone or using the simulator. Android emulator and iOS and simulator are fine



Most likely your images are of high resolution and you are running out of ram. Flutter by default caches images at full resolution even if they appear in small boxes. You need to check things like cacheHeight and cacheWidth and use appropriate size images.

And check your dev tools to monitor performance- it's your best indicator.