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

adjust vector_graphics errorBuilder (to trigger on BytesLoader errors) #219

Open
Yagorundy opened this issue Oct 13, 2023 · 1 comment
Open

Comments

@Yagorundy
Copy link

COPIED FROM dnfield/flutter_svg#996

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

@pedromassango
Copy link

pedromassango commented Aug 21, 2024

This happens with local files as well, and would be great to have a callback so we default to a non-optimised svg image.

dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3  throw_
packages/vector_graphics/src/listener.dart 133:5                             decodeVectorGraphics
packages/vector_graphics/src/vector_graphics.dart 356:14                     <fn>
dart-sdk/lib/async/zone.dart 1661:54                                         runUnary
dart-sdk/lib/async/future_impl.dart 163:18                                   handleValue
dart-sdk/lib/async/future_impl.dart 847:44                                   handleValueCallback
dart-sdk/lib/async/future_impl.dart 876:13                                   _propagateToListeners
dart-sdk/lib/async/future_impl.dart 652:5                                    [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 722:7                                    callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7           <fn>
Error

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

2 participants