[Solved] pubspec.yaml: A package may not list itself as a dependency.
Table of Contents
When I got this issue ?
This error I got for url_launcher package. But actual issue is when the dependency you have added and the project name of yours is exactly same then you will encounter this issue.
My dependency with error:
pubspec.yaml
name: url_launcher description: A new Flutter project. dependencies: url_launcher: ^5.5.0 flutter: sdk: flutter
Fix
Fix is very simple, you just need to rename your project.
Working code for your reference:
pubspec.yaml
name: url_launcher_demo description: A new Flutter project. dependencies: url_launcher: ^5.5.0 flutter: sdk: flutter