swapnil mane
swapnil mane

Reputation: 257

Getting error while implementing web-view in flutter applications

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',
      ),
    );
  }
}

Upvotes: 3

Views: 7228

Answers (2)

Ashish
Ashish

Reputation: 324

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

Upvotes: 1

Pradip D.
Pradip D.

Reputation: 692

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!

Upvotes: 3

Related Questions