flutter_html image src tag in single quote

I am using flutter_html in my flutter project using Android Studio. I have an issue in displaying the html code for the image tag(I got the html content from an xml), where the src is in single quote:

<a class='article-gallery__image-container' href='https://xxxxx/xxx.jpg'> 
<img alt="xxxx" src='https://xxxxx/xxxx.jpg' class='article-gallery__image' title="xxxxx" /></a>

I have another article content extracted from xml where the image src tag is in double quote, the image can be shown:

<img width="500" src="https://xxxx/xxxx.jpg" />

If the src tag is in single quote, the image cannot be shown, however if the image src tag is in double quote, the image can be shown, how could I fix this problem? thanks.

1 answer

  • answered 2020-11-25 07:22 MRazaImtiaz

    flutter_html is still adding more tags and enhancement, not every tag is supported in flutter_html.

    Regarding your problem actually you can replace the single quote with the double quote

        s.replaceAll("'", "\"");

    but pls be sure it doesn't effect any other tags.

    or if the all image is in jpg then replace like this

    s.replaceAll("jpg'", "jpg\"").replaceAll("''http", "\"'http");