Masoud H
Masoud H

Reputation: 343

error when using the flutter url_launcher: ^5.4.2 i get G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link

When I add the url_launcher: ^5.4.2 to my pubspec.yaml and I run my flutter app.

Then I get this error:

> /G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link.dart:85:21:
> Error: Method not found: 'SystemNavigator.routeInformationUpdated'.
>     SystemNavigator.routeInformationUpdated(location: routeName);
>                     ^^^^^^^^^^^^^^^^^^^^^^^ /G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link.dart:108:12:
> Error: Getter not found: 'Router'.
>     return Router.of(context) != null;
>            ^^^^^^

And my flutter version is :

Flutter 1.22.0 • channel master • https://github.com/flutter/flutter.git
Framework • revision 7ec2d360bc (11 months ago) • 2020-07-29 23:25:38 -0700
Engine • revision a9910e409c
Tools • Dart 2.10.0 (build 2.10.0-1.0.dev 24c7666def)

Upvotes: 1

Views: 470

Answers (2)

Quick learner
Quick learner

Reputation: 11467

Solution 1 ) Lower down the library version to somewhere like 5.7.0, 5.7.1, 5.7.2, 5.7.4, 5.7.5 NOTE :- If you still face the issue Go to this directory /G:/flutter/.pub-cache/hosted/pub.dartlang.org/ and delete url_launcher_platform_interface Then run flutter clean then flutter pub get

Solution 2 ) Update your SDK to Latest to use latest library in your project

DOING THIS ALONE MIGHT SOLVE YOUR PROBLEM Go to this directory /G:/flutter/.pub-cache/hosted/pub.dartlang.org/ and delete url_launcher_platform_interface Then run flutter clean then flutter pub get

Upvotes: 1

Divyesh
Divyesh

Reputation: 2413

You need to update your flutter sdk I think.

My flutter version shows 2.0.6 and new version than this is also available.

Latest version of url_launcher is: url_launcher 6.0.6

So update this two things first this might solve your problem.

How to upgrade flutter sdk? (Run these commands in terminal)

$ flutter channel dev
$ flutter upgrade

You can install latest sdk directly using:

git clone https://github.com/flutter/flutter.git -b stable

I have installed url_launcher 6.0.6 version and app is running fine, here is my flutter sdk details:

Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (7 weeks ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3

Upvotes: 1

Related Questions