Flutter Windows app crashes without error while loading multiple images from local disk

Issue

I created a multi image selector form field widget to use within a form with validation and so on, and it works fine; however, when I select 8 or more images from a file picker at once and add them to the selected images list, which would be displayed in an image widget within a GridView, the app crashes without any errors.

I even tried the app on Android to see if it happened there, but everything was OK even when I added 10+ images at a time.

I’m wondering if there’s any way to debug this because I’m at a loss for what to do right now with no errors.

i’ve tried these:

  • Using a 50×50 pixel size cache for the selected image list to avoid loading a large amount of data at once

Solution

It turned out to be file_picker v4.0.0 causing the issue
Apparently, when you select files using this package, it will interact with the file, either loading it or whatnot. I’m not sure, but I discovered it by removing image widgets and only displaying the selected image paths using a text widget and it still crashed, so I was certain it was the file picker’s fault and chose to use file picker cross even though it depends on file picker it was working differently and it didn’t crash the app even with 20 images selected.

Answered By – Arin Faraj

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *