0

When I want to add the "flutter_iconpicker" package to my current flutter project, it gives the error in question below. I updated the flutter and dart versions on my computer but that didn't work.

The current Dart SDK version is 2.18.1.

Because sample_project depends on flutter_iconpicker >=3.2.3 which requires SDK version >=3.0.0 <4.0.0, version solving failed.
pub get failed (1; Because sample_project depends on flutter_iconpicker >=3.2.3 which requires SDK version >=3.0.0 <4.0.0, version solving failed.)

flutter --version output:

Flutter 3.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 682aa387cf (7 days ago) • 2023-06-05 18:04:56 -0500
Engine • revision 2a3401c9bb
Tools • Dart 3.0.3 • DevTools 2.23.1

The pubspec.yaml code on the subject is below.

environment:
  sdk: '>=2.18.1 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  google_fonts: ^4.0.4
  flutter_svg: ^1.1.3
  flutter_staggered_grid_view: ^0.6.2
  url_launcher: ^6.1.10
  visibility_detector: ^0.4.0+2
  provider: ^6.0.5
  firebase_core: ^2.13.1
  cloud_firestore: ^4.8.0
  flutter_iconpicker: ^3.2.4

Thanks to everyone who has responded so far.

1 Answers1

0

I was getting the issue in Android Studio. I noticed that when I try to run it with Vs Code or via terminal, I don't get an error. Later I noticed that my dart sdk path "Android Studio>Settinigs>Languages>Dart>Dart Sdk Path" was linked to an old version. I solved my problem by changing the path here with the current sdk path.

Thanks to everyone who replied.