How to Fix “Flutter Riverpod Depends on Flutter Riverpod, Version Solving Failed” Error

Binni G. 🎧🦋
3 min readMar 13, 2023

Flutter Riverpod is a widely used state management library for Flutter that provides an elegant and concise way to manage application state. However, one issue that developers may encounter when using Flutter Riverpod is the error: “flutter_riverpod depends on flutter_riverpod, version solving failed”.

In the below example, I created a new flutter project. Now when I was trying to add flutter_riverpod dependency I was getting this error:

Because flutter_riverpod depends on flutter_riverpod, version solving failed.
pub finished with exit code 65

In some cases, this error occurs when the project is named “flutter_riverpod”, which can create conflicts in the dependencies.

In this article, we will explore this error and provide steps to fix it.

Understanding the Problem

When developing a Flutter application, it is essential to choose a unique name for your project. If you name your project “flutter_riverpod”, it can create conflicts in the dependencies as Flutter Riverpod depends on Flutter Riverpod. When the project and library have the same name, Flutter gets confused about which version of the library to use, leading to a version solving failure error.

Causes of the Error

The version solving failure error occurs when there is a conflict in the dependencies. In the case of using “flutter_riverpod” as the project name, it creates a conflict with the Flutter Riverpod library as both have the same name. As a result, Flutter cannot determine which version of the library to use, leading to a version solving failure error.

Fixing the Error

To fix the version solving failure error caused by using “flutter_riverpod” as the project name, you can follow the steps below:

Step 1: Rename Your Project

The first step in fixing the error is to rename your project to a unique name. You can do this by updating the name field in the pubspec.yaml file of your project. Ensure that the new name you choose is unique and does not conflict with any existing libraries or projects.

Step 2: Update the Version of Flutter Riverpod

If you have already installed the Flutter Riverpod library in your project, you need to update the version to the latest version. You can do this by updating the version number in the pubspec.yaml file of your project. Once you have updated the version number, run flutter pub get to install the new version of Flutter Riverpod.

Step 3: Clean and Rebuild Your Project

Once you have renamed your project and updated the version of Flutter Riverpod, you should clean and rebuild your project. To do this, run flutter clean to delete the build/ directory and then run flutter run to rebuild your project.

Conclusion

Choosing a unique name for your Flutter project is essential to avoid conflicts in dependencies. If you encounter the version solving failure error when using Flutter Riverpod, and you have named your project “flutter_riverpod”, the error is likely caused by the name conflict. By following the steps outlined in this blog, you can fix the error and continue developing your Flutter application with Flutter Riverpod.

Voilà, it’s done. Error will be gone now.

If you know other ways , share in the comments for everyone!

Thanks For Reading, Follow Me For More

--

--