Reputation: 1
I am trying to add flutter_inappwebview 6.0.0. My code has no error but web page is not loading.
Here is my code:
class SettingsPage extends StatefulWidget {
const SettingsPage({Key? key}) : super(key: key);
@override
_SettingsPageState createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
InAppWebViewController? webViewController;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Settings"),
),
body: InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri("https://www.google.com"), // Using WebUri directly
),
onWebViewCreated: (controller) {
webViewController = controller;
},
),
);}}
Upvotes: 0
Views: 142
Reputation: 21
You may check again if your project fulfilled the requirements of the package and platform installation setup.
There is an alternative way, you can use url_launcher(https://pub.dev/packages/url_launcher) package to help you with your code.
await launchUrl(
url,
mode: LaunchMode.inAppBrowserView
);
Upvotes: 0
Reputation: 430
You should provide more detail like is it only happen on IOS or android but if you have this problem that web didn't load on android device try this
add this to dependency_override
in pubspec.yaml
webview_flutter_android: 3.16.1
or you can migrate flutter_inappwebview
to newer version like 6.1.5 that im just migrate today and it work perfectly but if you really want to use 6.0.0 above method is what you have to do
Upvotes: 0
Reputation: 11477
Did you add the internet permission for android?
Make sure to add the internet permission
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
...
...
</application>
</manifest>
Upvotes: 0