flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Provide option to ignore errors

Open martin-robert-fink opened this issue 4 years ago • 7 comments

I'm using Omnigraffle to create SVG assets and it provides extra elements (example: "metadata" is used to include version information) and it also includes "font-face" (I'm using a font loaded from assets, so it's not an issue). But, these cause flutter_svg to output errors as these are not supported elements. My stuff renders fine, I just want to have the ability to remove these parsing errors as they are not helpful.

martin-robert-fink avatar Aug 03 '21 19:08 martin-robert-fink

Is there some reason that you can't just remove the unused tags from your file? It would both reduce the parse time and the bundle size of your application.

dnfield avatar Aug 16 '21 18:08 dnfield

Hi Dan - Thanks for checking in. No, technically, there's no reason and that is my current workaround. The issue is that I do all of my app icons this way (I have about 50 of them so far), and it was a bit tedious to manually go remove all the unused/unsupported tags by hand. My next move is to write a dart based command line tool to automate the process. If you tell this is not something worth dealing with, I'll do that. I guess I was always of a mind that unsupported tags are just ignored rather than generate error messages, but maybe there's a good reason for it and I'm not aware.

martin-robert-fink avatar Aug 16 '21 18:08 martin-robert-fink

I've found svgcleaner to be pretty good at cleaning a lot of that stuff up and compressing the SVG down a bit further. If you have a build rule set up for that it'd be cool to add here or in another package.

dnfield avatar Aug 16 '21 19:08 dnfield

Thanks for the pointer, I will give it a try. In my read through the docs though, it looks like it won't remove font-face which is one of the problem elements. Thanks again!

martin-robert-fink avatar Aug 16 '21 20:08 martin-robert-fink

Ahhh yes you are right.

dnfield avatar Aug 16 '21 20:08 dnfield

....the other option is of course to just support font-face :)

dnfield avatar Aug 16 '21 20:08 dnfield

Well, get on that :)....

martin-robert-fink avatar Aug 16 '21 20:08 martin-robert-fink