简体   繁体   中英

how to solve "Target of URI doesn't exist package:flutter_facebook_login/flutter_facebook_login.dart" in flutter?

i am a noob and trying to run an app that i cloned from github but i am getting this error i tried everything i could find on various sites but couldn't get rid of this error in dart analysis tab:

error: Target of URI doesn't exist: 'package:flutter_facebook_login/flutter_facebook_login.dart'. (uri_does_not_exist at [flutter_app] lib\login_page.dart:2)

here is the code for login_page.dart file: https://codeshare.io/5eEKNJ

already added the dependencies such as:

   firebase_auth: ^0.18.4+1

   cloud_firestore: ^0.14.4

   firebase_core: ^0.5.3

   flutter_login_facebook: ^0.4.1

and already created the facebook app and have given the app id and secret key is the string.xml but the

Edit: already tried flutter pub get and restarted the ide and the issue is still there

Okay it was confusion with the package name there are 2 packages 1.flutter_facebook_login: ^3.0.0 2.flutter_login_facebook: ^0.4.1

the first one was causing issues because in the pubspec.yaml the second one was listed under dependencies and not the first one

I was facing similar issue while using vs code, but not with android studio. In vs code, after writing package name with desired version in pubspec.yaml file, I used import statement in one of dart file in lib directory. Then I went to Close Folder from File menu. Vs code prompted to save changes. Later, through terminal, I opened the folder in which I was working, after which a pop up dialogue appeared at bottom right of vs code, prompting to install missing plugins. Then I clicked to install missing plugins, which runs flutter pub get on its own, and then the problem is solved.

Solution 1

I think You have to get all packages. That's why you are facing this issue. Just open the terminal from the project directory and run.

1- flutter clean

2- flutter packages get

Boom. Your Error must be solved.

Solution 2

or try

1- Just press Ctrl + Shift + A (Find Action).

2- Search for “Dart Analysis”.

3- Click the icon that says “Restart the Dart Analysis server”

Now, Your red underline disappears from the package import, and everything works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM