WebView in Flutter Web
You can try using the easy_web_view plugin.
For iOS and Android, it uses the native webview_flutter plugin and for the Web, it does similar things from the @alex89607 answer.
EDIT: Here is a runnable example as of May 16, 2021:
import 'dart:html';
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
void main() {
// ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(
'hello-world-html',
(int viewId) => IFrameElement()
..width = '640'
..height = '360'
..src = 'https://www.youtube.com/embed/IyFZznAk69U'
..style.border = 'none');
runApp(Directionality(
textDirection: TextDirection.ltr,
child: SizedBox(
width: 640,
height: 360,
child: HtmlElementView(viewType: 'hello-world-html'),
),
));
}
The remainder of this post just replicates what's above, and is the original post by the original author
You need at first perform platformViewRegistry:
ui.platformViewRegistry.registerViewFactory(
'hello-world-html',
(int viewId) => IFrameElement()
..width = '640'
..height = '360'
..src = 'https://www.youtube.com/embed/IyFZznAk69U'
..style.border = 'none');
Look at that example. In that example old library was imported (on 29.09.19), but if you change 'flutter_web' on 'flutter' it have to work.
Also, you can use not only 'IFrameElement', it can be regular html:
ui.platformViewRegistry.registerViewFactory("simple_div", (int viewId) {
DivElement element = DivElement();
...
return element;