'InAppWebView is not working in flutter web app - Desktop
I have used InAppWebView plugin to load webview. It works fine in android and iOS. But in flutter web app, it throws error as plugin not supported. Kindly suggest some solution or an plugin that works fine in all platforms.
Solution 1:[1]
InAppWebview or Webview isn't supported in Flutter Web.
Check this package out: https://pub.dev/packages/webviewx
This is an example:
import 'package:flutter/material.dart';
import 'package:webviewx/webviewx.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return const Scaffold(
body: WebViewX(
initialContent: "https://flutter.dev/",
width: double.maxFinite,
height: double.maxFinite,
),
);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
