Version resolving failed, Shared Preferences with Audio Recorder

Issue

Trying to add audio_recorder as a dependency with shared_preferences gives version resolving failed.

Because shared_preferences_windows 2.0.0 depends on file ^6.0.0 and no versions of shared_preferences_windows match >2.0.0 <3.0.0, shared_preferences_windows ^2.0.0 requires file ^6.0.0.
And because audio_recorder >=0.0.6 depends on file ^5.0.4, audio_recorder >=0.0.6 is incompatible with shared_preferences_windows ^2.0.0.
And because shared_preferences 2.0.5 depends on shared_preferences_windows ^2.0.0 and no versions of shared_preferences match >2.0.5 <3.0.0, audio_recorder >=0.0.6 is incompatible with shared_preferences ^2.0.5.
So, because my_app depends on both shared_preferences ^2.0.5 and audio_recorder ^1.0.2, version solving failed.
pub get failed (1; So, because my_app depends on both shared_preferences ^2.0.5 and audio_recorder ^1.0.2, version solving failed.)

Tried using flutter_audio_recorder package instead but it gives the same error.

Solution

Let pub find which version works by not specifiying the version of audio_recorder plugin in pubspec.yaml, like this:

audio_recorder:

Now run flutter pub get and then, optionally you can look in the pubspec.lock and see what version you got so you can put it in the pubspec.yaml file.

Answered By – Andrej

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.