webImage function

Widget webImage({
  1. required BuildContext context,
  2. required String imageUrl,
  3. double? width,
  4. double? height,
})

This widget creates a view for the browser with HTML. A hole is cut in the flutter canvas, so to speak, where the is rendered.

Implementation

Widget webImage({
  required BuildContext context,
  required String imageUrl,
  double? width,
  double? height,
}) {
  // ignore: undefined_prefixed_name
  ui.platformViewRegistry.registerViewFactory(
      imageUrl,
      (int viewId) => ImageElement(
            src: imageUrl,
            width: width?.toInt(),
            height: height?.toInt(),
          ));
  return SizedBox(
    width: width,
    height: height,
    child: HtmlElementView(viewType: imageUrl),
  );
}