Flutter Error: No named parameter with the name 'isVisible' error on url_launcher_web and pointer_interceptor

Viewed 3692

after running flutter pub upgrade I get these errors when I run flutter build web

../../development/flutter/.pub-cache/hosted/pub.dartlang.org/pointer_interceptor-0.9.2/lib/src/web.dart:31:6: Error: No named parameter with the name 'isVisible'.
  }, isVisible: false);
     ^^^^^^^^^

../../development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.7/lib/url_launcher_web.dart:50:61: Error: No named parameter with the name 'isVisible'.
        .registerViewFactory(linkViewType, linkViewFactory, isVisible: false);
8 Answers

I had the same problem with url_launcher_web which did not solve by running flutter pub get. In my case upgrading the flutter version fixed the problem.

Before:

Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (4 months ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

After:

Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (3 days ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2

The issue is that Url_launcher 6.0.18 automatically updated the internal library url_launcher_web from 2.0.6 to 2.0.7.
Now 2.0.7 uses flutter 2.10 and 2.0.6 uses flutter 2.5. They did that without "requiring" flutter 2.10 (which they fixed with url_launcher 2.0.8). But if you're still at flutter <2.10 you'll have an issue.

There is 2 options you have here:

  1. cheap option. (I am using this now right now as a "hotfix"): Add this to your pubspec.yaml (below dependencies or dev_dependencies)
dependency_overrides:
  url_launcher_web: 2.0.6

This just makes url_launcher load the "right" version.

  1. The right option would be to upgrade your sdk to flutter 2.10 (with flutter upgrade). Maybe you just don't want to do that right now but you eventually should.

Add this line into pubspec.yaml as shown in the image

dependency_overrides:
  url_launcher_web: 2.0.6

enter image description here

I searched isVisible: false property in url_launcher_web and pointer_interceptor packages files in the flutter dependencies directory and deleted them. After running flutter pub get in the terminal the errors were fixed.

You can use

dependency_overrides: url_launcher_web: 2.0.6 in your pubspec.yaml

I am also extending the answer that I am also facing this same issue and below solution is working for me. I have opened url_launcher_web.dart file from Dart Packages and go to url_launcher_web-2.0.7. After url_launcher_web.dart files I have removed isVisible: false from registerWith() method. like below

Before :

static void registerWith(Registrar registrar) {
    UrlLauncherPlatform.instance = UrlLauncherPlugin();
    ui.platformViewRegistry
        .registerViewFactory(linkViewType, linkViewFactory, isVisible: false);
  }

After:

static void registerWith(Registrar registrar) {
    UrlLauncherPlatform.instance = UrlLauncherPlugin();
    ui.platformViewRegistry
        .registerViewFactory(linkViewType, linkViewFactory);
  }

See as below whom using Android Studio: enter image description here

I had the same problem with url_launcher_web which did not solve by running flutter pub get. In my case adding this line on index.html fixed the problem.

enter image description here

you need to load right version. run this: flutter clean; flutter pub get;

then rebuild

Related