Recommended way to create a map snapshot, working on native and web? #1344
Unanswered
androidseb
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've implemented a snapshot feature in my flutter app and I was going to ask this question because my implementation was "not working" on web.
After searching for a while, I noticed this was due to this bug, and could be worked around with the
BROWSER_IMAGE_DECODING_ENABLED
flag.I'll still share the code here so that it helps others and so that I can get feedback too if there is a better recommended way to do this. The code is pretty simple and straightforward, but getting there was not trivial and took me a lot of time.
This technique uses the
RepaintBoundary
widget.This is the content of my
.vscode/launch.json
file:Important note: the "Debug" configuration does not work on web, only the "Release" one works.
These are my pubspec.yaml file's dependencies:
Here is the code:
Running this code and clicking the "Export snapshot" button provides the following image:
Please let me know if you see a better way to do this, thanks!
Beta Was this translation helpful? Give feedback.
All reactions