ygzkrmtc
ygzkrmtc

Reputation: 187

Why I can not add some packages to pubspec.yaml file?

When I try to add flutter_sound: ^7.7.0+1 to dependencies in pubspec.yaml and press to "pub get",,I recieve error message below, How can I solve this issue??

pubspec.yaml

name: lezzet_kitabi
description: A new Flutter application.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.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.2
  bordered_text: ^1.0.1
  sqflite: ^1.3.0
  path_provider: ^1.6.27
  provider: ^4.3.3
  integration_test: ^1.0.2+2
  camera: 0.5.8+17
  image_picker: ^0.6.7+22
  path: ^1.8.0
  flutter_sound: ^7.7.0+1


dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - images/logoBGopacity.png
    - images/logoBG.png
    - images/cuttedlogo.PNG
    - images/sticker0.png
    - images/sticker1.png
    - images/sticker2.png
    - images/sticker3.png
    - images/sticker4.png
    - images/sticker5.png
    - images/sticker6.png
    - images/sticker7.png
    - images/sticker8.png
    - images/sticker9.png
    - images/sticker10.png
    - images/sticker11.png
    - images/sticker12.png
    - images/sticker13.png
    - images/sticker14.png
    - images/sticker15.png
    - images/sticker16.png
    - images/sticker17.png
    - images/sticker18.png
    - images/sticker19.png
    - images/sticker20.png
    - images/sticker21.png
    - images/sticker22.png
    - images/stickerForRecipeScreen.png

  fonts:
   - family: Marck
     fonts:
       - asset: fonts/MarckScript-Regular.ttf
   - family: Graduate
     fonts:
       - asset: fonts/Graduate-Regular.ttf
   - family: OpenSans
     fonts:
        - asset: fonts/OpenSansCondensed-Light.ttf
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Error

Because flutter_sound >=6.4.3+42 depends on uuid ^2.2.2 which depends on crypto ^2.0.0, flutter_sound >=6.4.3+42 requires crypto ^2.0.0. And because every version of flutter_driver from sdk depends on crypto 3.0.0, flutter_sound >=6.4.3+42 is incompatible with flutter_driver from sdk. And because integration_test 1.0.2+2 depends on flutter_driver any from sdk and no versions of integration_test match >1.0.2+2 <2.0.0, flutter_sound >=6.4.3+42 is incompatible with integration_test ^1.0.2+2. So, because lezzet_kitabi depends on both integration_test ^1.0.2+2 and flutter_sound ^7.7.0+1, version solving failed. pub get failed (1; So, because lezzet_kitabi depends on both integration_test ^1.0.2+2 and flutter_sound ^7.7.0+1, version solving failed.)

Upvotes: 3

Views: 1964

Answers (1)

Kushal Goel
Kushal Goel

Reputation: 120

This problem is due to your project's dependencies depending on other packages.

There is a conflict in their versioning which can be resolved, as per the documentation.

You can read about it here (Official Flutter Docs).

Upvotes: 1

Related Questions