Vedo
Vedo

Reputation: 643

Flutter ImagePicker library cannot be found

Im trying to implement ImagePicker to my Flutter project but when i try to import the package: import 'package:image_picker/image_picker.dart'; it only shows error. I have added it to my pubspec.yaml file as a dependecie but it displayed this error when I reopened the VS:

Because LPP requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because LPP requires SDK version >=2.12.0 <3.0.0, version solving failed.)
exit code 1

This is my pubspec.ymal file:

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  image_picker: ^0.7.2+1

So any help would be great. Thanks in advance :) <3

Upvotes: 0

Views: 693

Answers (2)

Vedo
Vedo

Reputation: 643

Ok so I changed version from 7.2+1 to 6.2 and now it works. :)

Upvotes: 0

Moo
Moo

Reputation: 725

Which flutter- and dart-version shows "flutter doctor -v"?

Your sdk has to be >= 2.12

If you don't use flutter 2 with dart 2.12 than upgrade flutter (I have currently massive problem with this) or downgrade the versions of sdk, Cupertino-icons and image-picker in the pubspec.yaml-file

Upvotes: 1

Related Questions