sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: flutter
Issue: [flutter_svg]  polygon without points causes parsing issue.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/934_

Original report by @aggeloskoutanis on Jun 7, 2023

Hello,

I have been getting this error since I upgrade the package to 2.0.4.  

```
_CastError: Null check operator used on a null value
  File "loaders.dart", line 421, in SvgNetworkLoader.provideSvg
  File "loaders.dart", line 138, in SvgLoader._load.<fn>.<fn>
  File "_isolates_io.dart", line 18, in compute.<fn>
  File "isolate", line 954, in _RemoteRunner._run
  File "isolate_patch.dart", line 300, in _delayEntrypointInvocation.<fn>
  File "isolate_patch.dart", line 192, in _RawReceivePort._handleMessage
```

Does it have to do with the loader trying to access the image before it is loaded?

Flutter (Channel stable, 3.7.12, on macOS 13.3.1



---
Comment by @Kayes-Islam on Jul 21, 2024
I have the same error on this SVG file:
https://github.com/user-attachments/assets/1c6fd3a8-6f2b-48b8-8201-26489bd558a6

I have a number of other SVG files and they are working without problem. 

I'm using version: 2.0.10+1

---
Comment by @Kayes-Islam on Jul 21, 2024
OK so I did the below and now it's working:
1.   Got rid of couple of polygons that only had transform and fill like below:
     ```<polygon
     transform="translate(-0.020311,-25.843)"
     
     fill="#014953" />```
2. Removed id attributes such as `id="path27"`
3. Replaced style attribute with fill value to direct fill attribute. I.e. replaced `style="fill:#014953"` to `fill="#014953"`

Seems to be working now.

---
Comment by @Kayes-Islam on Jul 21, 2024
I had issue in another file, this time removing the below is the only fix I had to apply:
```<polygon fill="#fff" transform="translate(.002336 -9.95283)"/>```
Confirmed that polygon without points is causing this issue.
Repository: go
Issue: x/tools/gopls: add "Eliminate dot import" code action
Labels: help wanted,FeatureRequest,gopls,Tools,Refactoring

Sometimes we regret using dot imports but they are too tedious to remove. It would be easy (and ~~infallible~~ actually fallible) to offer a code action to automate this transformation. We could also offer the reverse ("Convert to dot import"), but perhaps we should not place temptation in front of weak mortals. (The reverse operation is fallible.)
Repository: flutter
Issue: [flutter_svg] Text offset in y direction
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/959_

Original report by @Huber1 on Jul 7, 2023

When i am using `SvgPicture.file()` for the following svg, it doesn't render the text in the correct location. Like you can see it is offset in y-direction
```svg
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Ebene_1" viewBox="0 0 1000 500" xml:space="preserve"><script xmlns=""/> 
<rect fill="#C79514" width="1000" height="500"/> 
<text text-anchor="middle" x="50%" y="50%" dy=".35em" font-family="Arial, sans-serif" font-weight="bold" font-size="425px" fill="#ffffff">21</text> 
<style xmlns="" class="darkreader darkreader--fallback">html, body, body :not(iframe) {
    background-color: #232425 !important;
    border-color: #777067 !important;
    color: #dddcd9 !important;
}</style></svg>
```
Location: https://www.mvv-muenchen.de/fileadmin/lines/02021.svg

![Screenshot_20230627-112424](https://github.com/dnfield/flutter_svg/assets/22856090/16db7b35-b845-4fea-880e-ab89ec0ee49c)

The Text is not, as expected centered vertically and horizontally, but only centered horizontally

Is it a coincidence that the bottom line of the text is centered?

The Image is not cropped. I put it inside a Center on a blank screen to make sure it is completely visible
Repository: flutter
Issue: [flutter_svg] mix blend mode on <g> not being applied to svg.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/965_

Original report by @kent-nexient on Jul 13, 2023

First, thanks for this great package.

Question: This svg does not render the same as Chrome and I have not been able to figure out why. Can you point out what may not be supported?

<svg width="429" height="192" viewBox="0 0 429 192" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="429" height="192" fill="#077DAF"/>
<g style="mix-blend-mode:luminosity" clip-path="url(#clip0_8687_104539)">
<path d="M263.129 41.4276L415.365 -0.64634L310.454 -8.58984L263.129 41.4276Z" fill="#0A528C"/>
<path d="M222.882 97.9993L263.129 41.4296L194.762 18.9453L222.882 97.9993Z" fill="#0076A8"/>
<path d="M263.129 41.4288L310.455 -8.58871L185.406 -35L263.129 41.4288Z" fill="#2081CE"/>
<path d="M109 -3.13592L194.762 18.9445L185.406 -35L109 -3.13592Z" fill="#003C7A"/>
<path d="M194.762 18.9445L263.129 41.4288L185.406 -35L194.762 18.9445Z" fill="#328ED8"/>
<path d="M415.365 -0.644531L263.129 41.4294L331.277 62.5449L415.365 -0.644531Z" fill="#5CC8EB"/>
<path opacity="0.3" d="M222.882 98.0018L194.761 18.9476L109 -3.13281L222.882 98.0018Z" fill="#00415D"/>
<path d="M429 95.3066L415.365 -0.644531L331.277 62.545L429 95.3066Z" fill="#127190"/>
<path d="M429.662 108.091L520.236 45.4741L413.292 -7.86193L429.662 108.091Z" fill="#328ED8"/>
</g>
<defs>
<clipPath id="clip0_8687_104539">
<rect width="320" height="105" fill="white" transform="translate(109)"/>
</clipPath>
</defs>
</svg>

Thanks

---
Comment by @kent-nexient on Jul 13, 2023
![Social Category SVG@2x](https://github.com/dnfield/flutter_svg/assets/49567110/ef2bcefd-b87a-4f21-bef2-d24f3dc410e3)


---
Comment by @kent-nexient on Jul 13, 2023
Appears to be an issue with impeller. If I run without impeller, it renders fine.
Repository: flutter
Issue: [flutter_svg] Svg network only show black rectangle
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/970_

Original report by @novannp on Jul 28, 2023

i have try this code and just show black 
`SvgPicture.network("https://lms.pptik.id/theme/image.php/fordson/core/1685632254/f/pdf")`

that url return svg: 
![image](https://github.com/dnfield/flutter_svg/assets/24910496/c2acbc20-3cc0-4cc3-8869-328398268a4d)

and this the result :
![image](https://github.com/dnfield/flutter_svg/assets/24910496/8033ec84-fd67-4f95-b2b8-c50eaa7cc8c7)


 thank you

---
Comment by @pratikiran on Jul 31, 2023
This is because the **URL** isn't serving a `static file`. Try to find the **URL** which serves static file.

**Example**: 
```dart
SvgPicture.network (
    "https://www.adobe.com/content/dam/cc/icons/Adobe_Corporate_Horizontal_Red_HEX.svg"
),
```
I hope this clears and helps @novannp .

---
Comment by @novannp on Jul 31, 2023
thank u for tha answer, that url can't convert to static because that url coming from api response, i dont have access to backend.
Repository: flutter
Issue: [flutter_svg] svg image show blur and serrated on web when spec size
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/979_

Original report by @gapkukb on Aug 18, 2023

HI,
I have tried to render svg on the web but got a bad result .
if me spec the image size on the svg , it will be shown blur serrated , if without size , it shown good. 
and it works good on app, 
the Problem only happened on web.

![image](https://github.com/dnfield/flutter_svg/assets/15757875/fca4bae0-5fb3-4593-9678-5a680adba8dc)


As the picture shows that the top picture show it works on web . 

Does anyone known how to resolve it ? 

thanks.
Repository: flutter
Issue: [flutter_svg] Support nested <svg> tags
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/983_

Original report by @kecson on Sep 6, 2023

https://api-mainnet.suifrens.sui.io/suifrens/0xb58aa2d1d137e480f8bd55094da2bb569cd51e2eb7d9415f7cd5a3c40cbd580b/svg
![image](https://github.com/dnfield/flutter_svg/assets/10434414/eebf7a36-4577-49e2-8524-acc1ae768f83)
Repository: flutter
Issue: [flutter_svg] [Feature Request] Support for switcher and error widget
Labels: package,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/986_

Original report by @milindgoel15 on Sep 15, 2023

A switcher widget would be nice to automatically load up the resulting SVG from an asset or anywhere else from a placeholder widget and an error widget that provides a fallback widget if the asset or network image fails to load. Currently, if the asset does not load, it displays the error in the app.

The Switcher widget could be made similar to what cached_network_image does.
Repository: flutter
Issue: [flutter_svg] implement the textLength attribute.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/993_

Original report by @Zeebzog on Oct 5, 2023

This attribute seems to be ignored, am I doing something wrong?

`<?xml version="1.0"?>
<svg width="100" height="100"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"><text x="50" y="40" font-size="12px" fill="black" text-anchor="middle" textLength="90" lengthAdjust="spacingAndGlyphs" >Short  </text><text x="50" y="80" font-size="12px" fill="black" text-anchor="middle" textLength="90" lengthAdjust="spacingAndGlyphs" >Really Long String  </text>
</svg>`

Should result in:

![image](https://github.com/dnfield/flutter_svg/assets/78379592/cb32e724-5f0c-4854-a0e5-d31c67b6136e)

But instead you get:

![image](https://github.com/dnfield/flutter_svg/assets/78379592/f7f7ddbf-65e3-4c5a-9c31-92a475a1cc1c)


---
Comment by @dnfield on Oct 10, 2023
This is part of SVG2 and not implemented. But I have no objections to implementing it if someone wants to create a patch.

---
Comment by @dnfield on Oct 10, 2023
Sorry, it is part of 1.1 too and just not implemented :)
Repository: godot
Issue: Hitting CTRL+S repeatedly doesn't save resource each time with C#-based editor plugin and resource
Labels: bug,topic:editor,topic:dotnet

### Tested versions

- Reproducible in: v4.3.stable.mono.official [77dcf97d8], v4.4.dev4.mono.official [36e6207bb]

### System information

Godot v4.3.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 6700 XT (Advanced Micro Devices, Inc.; 32.0.11027.1003) - AMD Ryzen 7 5700G with Radeon Graphics (16 Threads)

### Issue description

I'm making a custom full-screen editor for my custom resources.

When hitting CTRL+S, the `_ApplyChanges` method gets called, but the changes introduced to the resource inside its code aren't saved, instead they are only visible in the resource's inspector. Hitting ENTER key while focused on the inspector's field and then CTRL+S applies the new value.

This extra step is not needed for GDScript-based editor plugins. For reference, I'm attaching both GDScript and CSharp version which does the exactly same thing.

If the problem is unsolvable, perhaps it would be feasible to expose `EditorNode::save_resource()` method in `EditorInterface` to be able to do the save manually inside `_ApplyChanges` method.

Note that on 4.3, it's even more broken than on 4.4.dev4

### Steps to reproduce

1. Load the MRP
2. Enter script editor
3. Inspect GDScript-based extension principle of operation:
  3.1. Right click the empty space in file explorer and create MyResource resource, name it myres.tres
  3.2. Observe that resource file contains `my_str = "default edited"`
  3.3. Hit CTRL+S 3 times
  3.4. Observe the "scene has no root" error triggering 3 times, and that resource file contains `my_str = "default edited edited edited edited"`
4. Inspect C#-based extension's principle of operation:
  4.1. Right click the empty space in file explorer and create MyResourceCs resource, name it mycs.tres
  4.2. Observe that resource file contains `_my_str = "default edited"`
  4.3. Hit CTRL+S 3 times
  4.4. Observe that "scene has no root" error doesn't trigger at all, and that resource file still contains `my_str = "default edited"`
  4.5. Observe that resource inspector contains value `default edited edited edited edited`
  4.6. Observe that hitting ENTER while focused on it and pressing CTRL+S triggers the "scene has no root" error and that the resource file contains `_my_str = "default edited edited edited edited edited"`

### Minimal reproduction project (MRP)

[res_editor_save_repro.zip](https://github.com/user-attachments/files/17737307/res_editor_save_repro.zip)
Repository: flutter
Issue: [flutter_svg] Add errorBuilder to SvgPicture and adjust underlying vector_graphics errorBuilder (to trigger on BytesLoader errors)
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/996_

Original report by @Yagorundy on Oct 11, 2023

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](https://github.com/dnfield/flutter_svg/assets/37158158/86f47c34-6f67-461a-83af-4e4cc9483821)




---
Comment by @guopeng1994 on Nov 24, 2023
WE NEED THIS!!

---
Comment by @mnayef95 on Sep 12, 2024
I've created a PR on `vector_graphics`. Once @dnfield approves it, we can update `flutter_svg` to handle it.

https://github.com/dnfield/vector_graphics/pull/255
Repository: flutter
Issue: [flutter_svg] Proposal to add `ColorMapper.fromCallback` constructor
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1003_

Original report by @jtarkowski27 on Oct 19, 2023

Personally I find it a bit excessive having to write a new class extending `ColorMapper` just to override one method which is `ColorMapper.substitute`. This method is usually quite simple an can be expressed in few lines of code without any complex logic. 

For cases like that I propose to add the new `ColorMapper.fromCallback` named constructor that would take the `substitute` method as a callback. Somewhat precise implementation would be something like this.

```dart
abstract class ColorMapper {
  const ColorMapper();
  
  const factory ColorMapper.fromCallback(
    SubstituteCallback substitute,
  ) = _ColorMapperCallback;

  Color substitute(
    String? id,
    String elementName,
    String attributeName,
    Color color,
  );
}

class _ColorMapperCallback implements ColorMapper {
  const _ColorMapperCallback(this._substitute);

  final Color Function(
    String? id,
    String elementName,
    String attributeName,
    Color color,
  ) _substitute;

  @override
  Color substitute(
    String? id,
    String elementName,
    String attributeName,
    Color color,
  ) =>
      _substitute(
        id,
        elementName,
        attributeName,
        color,
      );
}
```

---
Comment by @dnfield on Oct 19, 2023
I don't see why not. It could make evolving the ColorMapper interface harder but I'm not sure how much evolution it really would/will need.
Repository: flutter
Issue: [flutter_svg] Scaling for flutter web is broken in version 3.16.0
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1013_

Original report by @ifuterman on Nov 20, 2023

We are forced to use supersampling to display images correctly. After updating flutter to version 3.16.0, part of the icon is cut off when scaling. everything worked correctly in version 3.13.8

```
Transform.scale(
        filterQuality: FilterQuality.medium,
        scale: 0.5,
        alignment: Alignment.center,
        child: Transform.scale(
          scale: 2,
          child: SvgPicture.asset(
            asset,
            width: width,
            height: height,
            colorFilter: color != null ? ColorFilter.mode(overrideColor ?? color, BlendMode.srcIn) : null,
            clipBehavior: Clip.antiAlias,
          ),
        ),
      );
```

![expected result (version 3.13.8)](https://github.com/dnfield/flutter_svg/assets/22131565/7b96cb56-700b-46f2-b2e5-40c87450ea28)
![broken (version 3.16.00)](https://github.com/dnfield/flutter_svg/assets/22131565/e878af2f-89de-4ff0-a43a-1058d5595d14)



---
Comment by @dnfield on Nov 20, 2023
What platform(s) are you observing this on?

---
Comment by @ifuterman on Nov 21, 2023
> What platform(s) are you observing this on?

WEB canvasKit. We test it in chrome (windows, Mac)

---
Comment by @ifuterman on Nov 22, 2023
Maybe is this the solution? https://github.com/dnfield/flutter_svg/issues/668#issuecomment-1786082177

---
Comment by @adonisRodxander on Dec 4, 2023
Same issue with flutter sdk 3.13.6 

---
Comment by @ifuterman on Dec 4, 2023
> Same issue with flutter sdk 3.13.6

For me it works with 3.13.xx
Repository: flutter
Issue: [flutter_svg] preserveAspectRatio is not used when rendering the SVG.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1021_

Original report by @samorian on Dec 18, 2023

We display the following SVG with SvgPicture.memory(...) and SvgPicture.string(...) in our Flutter App(flutter_svg: 2.0.9).

```
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 640 360">

<image preserveAspectRatio="xMidYMid meet" width="136" height="136" transform="translate(550.5 276) scale(.47)" href="data:image/png;base64,{base64image}" />

 </svg>
```

`preserveAspectRatio="xMidYMid meet"`  is not applied and the image is incorrectly stretched by a different aspect ratio.

Rendered in the browser:
![image](https://github.com/dnfield/flutter_svg/assets/56042939/6aa7437f-daa0-4167-9718-e701bb8bd0a5)

Rendered in the app:
![image](https://github.com/dnfield/flutter_svg/assets/56042939/de5d9ea4-773d-4049-ab63-47fc6494644e)
Repository: flutter
Issue: [flutter_svg] Major Crash on Mobile Web when using SvgPicture.asset with flutter_svg
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1032_

Original report by @SzymonDziak on Jan 18, 2024

## Description
When using `SvgPicture.asset` to render SVG images on a mobile web application, the app experiences a major crash. This issue seems to occur only on the mobile web and not on other platforms.

## Steps to Reproduce
1. Use `SvgPicture.asset` to load and display an SVG image in a Flutter application.
2. Run the application on a mobile web browser.
3. Navigate to the page where the SVG is rendered.

## Expected results:
The SVG image should render correctly without causing any crashes.

## Actual results:
The application crashes when attempting to render the SVG image.

## Additional Information
- Flutter version: 3.16.0
- flutter_svg version: 2.0.9
- Browser(s) tested: Chrome, Safari, DuckDuckGo
- Can't find any error logs or stack traces that occur during the crash as it only happens on mobile browsers.

## Example Code
dart
```
Padding(
padding: const EdgeInsets.only(right: 12.0),
child: SvgPicture.asset(
"assets/svg/open_right_lock.svg",
width: 22,
colorFilter: ColorFilter.mode(
CustomColor.textFieldText.value,
BlendMode.srcATop,
),
),
)
```

Link to the icon used in the example code: https://fonts.google.com/icons?selected=Material+Symbols+Outlined:lock_open_right:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=open+ri&icon.platform=web


---
Comment by @dnfield on Jan 18, 2024
Could you crete a dartpad example?
Repository: flutter
Issue: [flutter_svg] Add support for marker-end.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1039_

Original report by @Zeebzog on Feb 19, 2024

Hi,

I do need to know how to resolve this issue, if necessary I will try to address in the code if you point me in the right direction.
I appreciate that this is a known issue and the library does not support markers, but my comment on the previous request got no response.

Thank you.


The library is great, but I also need marker-end implemented. The library fails to draw the arrow head of the svg below.

`<svg` width="2788" height="1232" viewBox="0 -1232 2788 1232" xmlns="http://www.w3.org/2000/svg"><marker id="arrow" `refX="1" refY="5" markerWidth="4" markerHeight="4" viewBox="0 0 10 10" orient="auto" ><path d="M 0 0 L 10 5 L 0 10 z" `fill="black" /></marker><line x1="104" y1="-225" x2="164" y2="-225" stroke="black" stroke-width="2" marker-`end="url(#arrow)" /></svg>

Thank you.
Repository: flutter
Issue: [flutter_svg] Italic font style not supported in text tag.
Labels: package,P3,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/1040_

Original report by @guman24 on Feb 20, 2024

It's now working when I used font-style="italic" in svg text. 
```
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:svgjs="http://svgjs.dev/svgjs" width="1024" height="1024">
    <rect width="1024" height="1024" fill="url(#SvgjsLinearGradient1015)"></rect>
    <defs>
        <linearGradient x1="0.5" y1="1" x2="0.5" y2="0" id="SvgjsLinearGradient1015">
            <stop stop-opacity="0" stop-color="#ffd700" offset="40%"></stop>
            <stop stop-opacity="1" stop-color="#ffd700" offset="100%"></stop>
        </linearGradient>
    </defs><text font-family="Helvetica" font-size="96" text-anchor="start" font-weight="900" fill="#007f00"
        stroke-width="1" stroke="#000000" x="40" y="20" svgjs:data="{&quot;leading&quot;:&quot;1.3&quot;}"></text><text
        font-family="Poppins" font-size="63" text-anchor="start" font-weight="500" fill="#000000" x="40"
        y="126.884765625" font-style="italic" svgjs:data="{&quot;leading&quot;:&quot;1.3&quot;}">
        <tspan dy="0" x="40" svgjs:data="{&quot;newLined&quot;:true}">Adventure-Ready Elegance</tspan>
        <tspan dy="81.9" x="40" svgjs:data="{&quot;newLined&quot;:true}">new in the town now</tspan>
    </text>
    <rect width="383.6015625" height="144.05078125" fill="#000000" rx="72.025390625" ry="72.025390625" x="32"
        y="846.94921875"></rect>
    <rect width="379.6015625" height="138.05078125" fill="#1b1b1b" rx="69.025390625" ry="69.025390625" x="40"
        y="845.94921875"></rect><text font-family="Monoton" font-size="72" text-anchor="middle"
        font-weight="500" fill="#ffd700" x="229.80078125" y="942.90625"
        svgjs:data="{&quot;leading&quot;:&quot;1.3&quot;}">
        <tspan dy="0" x="229.80078125" svgjs:data="{&quot;newLined&quot;:true}">Buy Now</tspan>
    </text>
</svg>
```