flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Flutter_svg doens´t work over network

Open roberto-donext opened this issue 4 years ago • 7 comments

I have test this plugin using the network constructor and doesn´t work: I get this error:

The following ProgressEvent$ object was thrown resolving a single-frame picture stream: [object ProgressEvent]

When the exception was thrown, this was the stack Picture provider: NetworkPicture("https://DOMAIN/right-arrow.svg", headers: null, colorFilter: null) Picture key: NetworkPicture("https://DOMAIN/right-arrow.svg", headers: null, colorFilter: null)

My code is:


Column(
                children: [
                  SvgPicture.network(
                    "https://DOMAIN/public/right-arrow.svg",
                    width: 100,
                    height: 100,
                    semanticsLabel: 'A shark?!',
                    placeholderBuilder: (BuildContext context) => Container(
                      padding: const EdgeInsets.all(10),
                      child: const CircularProgressIndicator(),
                    ),
                  )
                ],
              )

I tested this exactly SVG over the network (doesn´t work) and just copy it in the assets folder, so , using SvgPicture.asset. And this works... So, the problem is not in the svg, because is exactly the same. The problem i guest is with the Plugin. I event tried to set the headers to this: headers: {'Content-Type': 'image/svg+xml'}, But does not work as well.

Any suggestion?

Thanks

roberto-donext avatar Sep 22 '21 15:09 roberto-donext

got same problem here, any one ?

zanpen2000 avatar Dec 15 '21 03:12 zanpen2000

any solution?

Sunsiha avatar Mar 02 '22 01:03 Sunsiha

same issue.

jacoblee1021 avatar Jan 21 '23 20:01 jacoblee1021

Same, for Flutter Web, it doesn't happen with the same SVG as an asset but gives an error when stored in Google Cloud Storage.

======== Exception caught by SVG ===================================================================
The following ProgressEvent$ object was thrown resolving a single-frame picture stream:
  [object ProgressEvent]

When the exception was thrown, this was the stack: 
Picture provider: NetworkPicture("https://firebasestorage.googleapis.com/v0/b/not_rea_bucket_name/o/ace.svg?alt=media", headers: null, colorFilter: null)
Picture key: PictureKey(Instance of 'NetworkPictureKeyData', colorFilter: null, theme: SvgTheme(currentColor: Color(0xff000000), fontSize: 16, xHeight: 8))
====================================================================================================
Flutter 3.7.0 • channel stable
Framework • revision b06b8b2710 (8 days ago) • 2023-01-23 16:55:55 -0800
Engine • revision b24591ed32
Tools • Dart 2.19.0 • DevTools 2.20.1

apoleo88 avatar Jan 31 '23 21:01 apoleo88

My bad. My issue was with web CORS restriction.

flutter_svg caught Exception doesn't show the real one, that was for me: XMLHttpRequest error

apoleo88 avatar Feb 02 '23 13:02 apoleo88

My bad. My issue was with web CORS restriction.

flutter_svg caught Exception doesn't show the real one, that was for me: XMLHttpRequest error

How did you fix your issue? I am having the same problem

davor-layer-four avatar Sep 12 '23 22:09 davor-layer-four

My bad. My issue was with web CORS restriction. flutter_svg caught Exception doesn't show the real one, that was for me: XMLHttpRequest error

How did you fix your issue? I am having the same problem

I fixed it, it was related to CORS and Firebase Storage. Just follow this youtube video: https://www.youtube.com/watch?v=tvCIEsk4Uas

davor-layer-four avatar Sep 19 '23 22:09 davor-layer-four