Getting error while implementing web-view in flutter applications

549

Solution 1

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!

Solution 2

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

Share:
549
swapnil mane
Author by

swapnil mane

Updated on January 04, 2023

Comments

  • swapnil mane
    swapnil mane 10 months

    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',
          ),
        );
      }
    }
    
    • Md. Kamrul Amin
      Md. Kamrul Amin over 1 year
      Are you using android phone? Your error message indicates TargetPlatform.windows
    • swapnil mane
      swapnil mane over 1 year
      Okay. I will try to run it on Android. Thank you