I am building a flutter app that has a web-view. I have updated the minsdkversion to 20. and added the android permission to use the internet but still getting the errror.click here to view error
DART
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() {
runApp(
const MaterialApp(
home: WebViewApp(),
),
);
}
class WebViewApp extends StatefulWidget {
const WebViewApp({Key? key}) : super(key: key);
@override
State<WebViewApp> createState() => _WebViewAppState();
}
class _WebViewAppState extends State<WebViewApp> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter WebView'),
),
body: const WebView(
initialUrl: 'https://flutter.dev',
),
);
}
}
CodePudding user response:
you are using webview_flutter that support platform Android and iOS, but you trying to run on web, that's why this error occurs.
Thanks,
Happy Codding!
CodePudding user response:
I ran your code into my machine it works fine on android devices. I hope you are running your app on an android or ios device because flutter_webview: any
version supports only Android and ios devices as per the official doc.
See this image