Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter path_provider and sdk version mismatch

Tags:

flutter

dart

The current Dart SDK version is 2.10.5.

Because path_provider 2.0.1 requires SDK version >=2.12.0-259.9.beta <3.0.0 and no versions of path_provider match >2.0.1 <3.0.0, path_provider ^2.0.1 is forbidden. So, because harmonoid depends on path_provider ^2.0.1, version solving failed. pub get failed (1; So, because harmonoid depends on path_provider ^2.0.1, version solving failed.)

How do i solved this error? this is my pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.8.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  animations: ^1.1.2
  provider: ^4.3.3
  assets_audio_player:
    git: https://github.com/alexmercerind/Flutter-AssetsAudioPlayer
  media_metadata_retriever: ^0.0.2+1
  http: ^0.12.2
  path: ^1.7.0
  path_provider: ^2.0.1
  flutter_local_notifications: ^3.0.3
  url_launcher: ^5.5.0
  permission_handler: ^5.0.1+1
  share: ^0.6.5+4
  palette_generator: ^0.2.3
  implicitly_animated_reorderable_list: ^0.3.2

dev_dependencies:
  flutter_test:
    sdk: flutter

error

enter image description here


2 Answers

My Dart SDK version is 2.12.0, and the Flutter version is 2.0.1. I created a new project and copied all your dependencies. The project worked without any problems.

For saving your time, I recommend upgrading to the stable channel and Flutter 2 using these commands or this link.

flutter channel stable
flutter upgrade
like image 96
Erfan Jazeb Nikoo Avatar answered Jun 27 '26 12:06

Erfan Jazeb Nikoo


If you don't want to migrate your Flutter and Dard SDK versions yet,

I would recommend you to try and remove the version from the line:

  • path_provider: ^2.0.1 so it would look like this: path_provider:
  • run: pub get again
  • run your project again

Eventually I would recomment to migrate to the newest version of the SDKs and upgrade all your dependencies. This is just a temporary solution.

like image 34
Robert Avatar answered Jun 27 '26 10:06

Robert