Target of URI doesn't exist: 'package:image_picker/image_picker.dart'

1.3k Views Asked by At

i tried everything i could to import image_picker and i find on various sites but couldn't get rid of this error :

import 'package:image_picker/image_picker.dart';

Target of URI doesn't exist: 'package:image_picker/image_picker.dart'. Try creating the file referenced by the URI, or Try using a URI for a file that does exis

already added the dependencies such as :

     dependencies:
       
       image_picker: ^0.8.4+8
     

Running "flutter pub get" it turns out to

OUTPUT:

The plugin flutter_plugin_android_lifecycle doesn't have a main class defined in C:\Users\Iradukunda Didier\Documents\flutter_windows_2.8.1-stable\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.5\android\src\main\java\io\flutter\plugins\flutter_plugin_android_lifecycle\FlutterAndroidLifecyclePlugin.java or C:\Users\Iradukunda Didier\Documents\flutter_windows_2.8.1-stable\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.5\android\src\main\kotlin\io\flutter\plugins\flutter_plugin_android_lifecycle\FlutterAndroidLifecyclePlugin.kt. This is likely to due to an incorrect androidPackage: io.flutter.plugins.flutter_plugin_android_lifecycle or mainClass entry in the plugin's pubspec.yaml. If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile. exit code 1

1

There are 1 best solutions below

0
G H Prakash On

Run flutter packages get instead of flutter pub get. If it does not work, Re-start the Visual Studio Code after flutter packages get

Source: