Home > Mobile >  On the use of Flutter plug-in image_picker [page is kill]
On the use of Flutter plug-in image_picker [page is kill]

Time:09-18

When using Flutter App development, involving the function of the camera photo album, so using the plugin image_picker, but in use process encountered a problem:
Android client application automatically restart when taking pictures occasionally happen, actually also not restart, is photographed after return will return to the first page to start running, namely re-execute initState,
I've tested put the camera on the first, second and third page, if it is the first page, will be rerun initState, then run the build, if this is the second, third page, will be immediately rerun initState and build the first page, and this two page execution not dispose of don't know, because of the console log directly to empty, to print,
The diagram below:


The problem is in the official document has explained:
Reference
Android system - day very rarely - sometimes kills the MainActivity after the image_picker finishes. When this happens, we lost the data selected from the image_picker. You can use retrieveLostData to retrieve the lost data in this situation.

This problem has the accidental, not good, the official way is to restore the lost data, but not to the solution of the application of automatic restart,
But if in formal application, this problem is very bad ah, don't know how to solve the
My test mobile:
  • Related