I have error I think it is on pubspec.yaml I did not completely understand the readme on fluter packages this is the code :
ElevatedButton(
onPressed: () {
final player = AudioCache();
player.play('7.mp3');
},
child: Text(''),
)
this is pubspec.yaml ( dependencies ) :
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
audioplayers: ^3.0.1
audioplayers: ^5.1.0
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
this is the error
[appname] flutter pub get
Running "flutter pub get" in appname...
The current Dart SDK version is 2.17.6.
Because appname depends on audioplayers >=4.1.0 which requires SDK version >=2.18.0 <3.0.0 or >=3.0.0 <4.0.0, version solving failed.
pub get failed (1; Because appname depends on audioplayers >=4.1.0 which requires SDK version >=2.18.0 <3.0.0 or >=3.0.0 <4.0.0, version solving failed.)
exit code 1
thank you for reading please if you know what is wrong help me !! I am new flutter learner
I tried to chance the pubspec.yaml ( dependencies ) : form audioplayers: ^5.1.0 to 4.1.0 and delete audioplayers: ^3.0.1
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
audioplayers: ^4.1.0
dev_dependencies:
flutter_test:
sdk: flutter