Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add errorBuilder to SvgPicture and adjust underlying vector_graphics errorBuilder (to trigger on BytesLoader errors) #996

Open
Yagorundy opened this issue Oct 11, 2023 · 2 comments

Comments

@Yagorundy
Copy link

My use case: I am trying to fallback to a svg in assets if my SvgPicture.network() fails for any reason (wrong url, request returns 404, invalid svg format, ...)

widgets like the Flutter Image fully support this errorBuilder and any error in the process (image loading/parsing/rendering) triggers the errorBuilder callback

From my observations:

  • SvgPicture widget does not accept errorBuilder
  • The vector_graphics package does not trigger errorBuilder for BytesLoader objects loadBytes() calls, it only triggers it for errors in decodeVectorGraphics()

image from vector_graphics.dart
image

@guopeng1994
Copy link

WE NEED THIS!!

@mnayef95
Copy link

mnayef95 commented Sep 12, 2024

I've created a PR on vector_graphics. Once @dnfield approves it, we can update flutter_svg to handle it.

dnfield/vector_graphics#255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants