Flutter webview iOS error "default webview implementation for targetPlatform.macOS but there isn't one"

Issue

I am new to Flutter, I tried webview with flutter and it works well with Android

I was trying to check it for iOS and I got
enter image description here

I am using

webview_flutter: ^3.0.0

Here’s my code for it

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(ScreenerWebView());

class ScreenerWebView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Screener',
      home: Scaffold(
        appBar: PreferredSize(
            preferredSize: Size.fromHeight(0),
            child: AppBar(
              // ignore: prefer_const_constructors
              title: SizedBox(
                height: kToolbarHeight,
              ),
            )),
        // ignore: prefer_const_constructors
        body: WebView(
          initialUrl: "https://www.google.com/",
          javascriptMode: JavascriptMode.unrestricted,
        ),
      ),
    );
  }
}

Solution

webview_flutter package does not support macOS target which is the reason why you see the error

when you’re on package’s pubdev have a look on the flutter badge under Published x days ago, most of the time it will tell you which platforms are supported, in case of webview_flutter it’s only android and ios
enter image description here

Answered By – eeqk

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *