-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/packages
#8080Labels
p: vector_graphicsThe vector_graphics package setThe vector_graphics package setpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Imported from dnfield/vector_graphics#219
Original report by @Yagorundy on Oct 13, 2023
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_graphicspackage does not triggererrorBuilderforBytesLoaderobjectsloadBytes()calls, it only triggers it for errors indecodeVectorGraphics()
image from vector_graphics.dart

Comment by @pedromassango on 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>
ErrorMetadata
Metadata
Assignees
Labels
p: vector_graphicsThe vector_graphics package setThe vector_graphics package setpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.