Hello Flutter Community,
I am currently working on a project that involves a Flutter application which essentially serves as a shell for a Vue3 web app, embedded via the webview_flutter
package. However, I am encountering an issue related to the loading times of remote images.
The Vue3 web app includes numerous heavy images which, when loaded remotely, can take a significant amount of time and consequently impact the user experience. To alleviate this, I am exploring ways to bundle these images with the Flutter application and fall back to these local assets when possible.
My idea is to have Flutter intercept each remote image request. If the required image is available in the local assets, Flutter should override the request and return the local image instead. If not, the remote request proceeds as usual.
Conceptually, the flow would be as follows:
- A request for a remote image is made.
- Flutter intercepts the request.
- Flutter checks if the requested image exists in the local assets.
- If it does, Flutter returns the local image. If not, Flutter allows the remote request to proceed.
Unfortunately, I am finding it difficult to find relevant resources for this particular problem. Most Flutter plugins or solutions seem to address the context of local HTML with local assets, whereas my scenario is about remote HTML with local assets.
Is such a logic feasible in Flutter? If so, could you guide me in the right direction in terms of implementation, or suggest any relevant plugins or tools that might be of use?
Additionally, if there are alternative approaches to optimize the loading of these heavy images in my context, I would be happy to hear your suggestions!
Thank you for your time and help.
Best Regards