commit | d15522813bad7365441e9e637dca605017b3aa97 | [log] [tgz] |
---|---|---|
author | Jeroen Weener <JeroenWeener@users.noreply.github.com> | Fri Apr 28 17:17:06 2023 +0200 |
committer | GitHub <noreply@github.com> | Fri Apr 28 15:17:06 2023 +0000 |
tree | 9f55a05c35c75223a94b7242783cca5f5ce3bbb4 | |
parent | 20b38ce332b98cb449641e04e9f1e352b0635b66 [diff] |
[image_picker] Move I/O operations to a separate thread (#3506) Many I/O operations in the `image_picker` are currently carried out on the main thread (at least on Android). This blocks the UI (main) thread, freezing the UI and sometimes even causing an ANR dialog to pop up. With these PR, many of said I/O operations now run on a separate thread. Specifically, it executes all code that is run in response to a picking result on a separate thread. So when an image is picked, for example, the callback will be ran outside of the UI thread. This change was rather easy, as said code was already making use of async paradigms. The I/O operations carried out for caching logic (`ImagePickerDelegate.retrieveLostImage()`) are **not** changed by this PR, as my guess is that this would call for breaking changes to the API, as the result is currently returned synchronously instead. When running the example app in [StrictMode](https://developer.android.com/reference/android/os/StrictMode) and picking an image, the problem becomes apparent, as it reports disk read/write violations. This was described in [#100966](https://github.com/flutter/flutter/issues/100966). I have verified that StrictMode no longer reports disk read/write violations after the changes. To check the output of StrictMode, I ran the example app with the changes listed [here](https://github.com/math1man/plugins/commit/11f5f8ace392d061b442d38e1237655bd5628f0f). This PR closes several issues related to ANRs. * Fixes [#94120](https://github.com/flutter/flutter/issues/94210) * Fixes [#114080](https://github.com/flutter/flutter/issues/114080) Also, it partly implements what is requested in [#91393](https://github.com/flutter/flutter/issues/91393).
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages
directory to see all packages.
These packages are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
These are the packages hosted in this repository: