registerGifView function
Registers a custom HTML ImageElement for Flutter Web. This is mainly used to render image formats (such as GIFs) that may not behave correctly with Flutter's default image widgets.
url -> Image URL to be displayed.
viewId -> Unique identifier used by HtmlElementView.
Implementation
void registerGifView(String url, String viewId) {
ui.platformViewRegistry.registerViewFactory(viewId, (int id) {
return html.ImageElement()
..src = url
..style.width = '100%'
..style.height = '100%'
..style.objectFit = 'contain';
});
}