I got this strange error while working on flutter recently. It happened when I was trying to install a new package.
My project name is wallpaper
I entered the dependency in pubspec.yaml file.
Turns out that flutter doesn’t allow to have the same name for the project and the dependency. So once I changed the project name and the name in the pubspec.yaml file, it was good to go.