You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flutter create uses directory name rather than package name to check name validity #53106
I tried to add web support to an existing mobile app. The name of the app in the pubspec.yaml is a valid package name. However, the directory that contains the package (which is derived from a git repository name) contains a dash "-" in the name. Running flutter create . in the package results in:
"xxxxx-xxxxxx" is not a valid Dart package name.
See https://dart.dev/tools/pub/pubspec#name for more information.
This same issue happened to us with a directory like com.xxxxxxxxxx.app, the workaround I did was to rename the folder and delete the wrongly generated files in android/ and ios/.
Reacted by Suresh Chouhan, Apoorv Pandey and Scott Wang
You need to pass --project-name like @jmagman says above. Is this not working?
Reacted by Savan1505, Joseph Ojoko, Apoorv Pandey, Yusif Jasim, Eleonor Menendez, Scott Wang, Jawand Singh, Aleksei Subbotin, Augustine, Fenja and 18 more
Reacted by Mahdi Akbary, Achudh Krishna, Daniel Gah and Andrii Kovalchuk
Reacted by Augustine, Teerasej Jiraphatchandej, Achudh Krishna, Daniel Gah, Andrii Kovalchuk and nagi233
It probably does, but it doesn't make sense to have to pass this option when adding web support to an existing project. The project name is right there in the pubspec.yaml file.
Reacted by Shawn, Steve Hawkins, daniel-cera, Indu Subramanian, Josh Kautz, Familusi Babatunde, Codeboy, Nishant Singh, Alex Stockwell, The Digital Alchemist and 6 more
The other issue is that the error message is misleading. While it technically correctly states that "xxxxx-xxxxxx" is not a valid Dart package name., it implies that "xxxxx-xxxxxx" is being used as a package name, which is wrong.
Reacted by Shawn, Codeboy, Nishant Singh, The Digital Alchemist, Eleonor Menendez, Scott Wang and Manuel Babuglia
Can we just have the run command just use the name as defined in .yaml or the module name?
I'm guessing a grand total of 0 people want to use the folder name as the name for their actual project. Especially as names change, and folders tend not to.
just now i faced the same issue after cloning a repository from github and i found out that after cloning the repository the file name was having capital letters that is not supported by dart, so i just renamed the folder and tried the command flutter create . and it worked.. i hope this helps to people facing the same problem as mine.
Reacted by Vineet J Karni, Sai Kiran Katayath, Ahmed Elnour, Prince Singh, 아리, daniel-cera, Josh Kautz, Ashutosh Singh, Mateusz Pietras, Daniel Anomfueme and 34 more
Reacted by Harsh Phoujdar, Kevin Lopez and Matko88
Reacted by Vineet J Karni, Sai Kiran Katayath, Josh Kautz, tisanthan, Ashutosh Singh, Harish Anbalagan, Amanda Shafack , Mahi, Amin Badri أمين بدري and Jose Manuel Martínez de la Insua
Reacted by Vineet J Karni, Sai Kiran Katayath, Prince Singh, Josh Kautz, Ashutosh Singh, Diego Martinez, Harish Anbalagan, Kedar K M, Cedric Wilson Thanikkal, Eng-Mushtaq and 5 more
Reacted by Vineet J Karni, Sai Kiran Katayath, Josh Kautz, Harish Anbalagan, Mahi and NNgocHai
Reacted by Vineet J Karni, Sai Kiran Katayath, Josh Kautz, Ashutosh Singh, Harish Anbalagan, Kirill and Mahi
Easyest Way Simply Create New Blank Project And Move "web" Folder To Your Project
That aint the easiest and best way
hmm maybe it might be but why when there's a command to do this..
I just feel like this is a solution that solves for temp puproses but not in a long run
just now i faced the same issue after cloning a repository from github and i found out that after cloning the repository the file name was having capital letters that is not supported by dart, so i just renamed the folder and tried the command flutter create . and it worked.. i hope this helps to people facing the same problem as mine.
IDK if you fixed it or not, but i had the exact the issue so i just rename my project name from "admin-panel" to "adminpanel" without any space and then the flutter create . worked perfectly
IDK if you fixed it or not, but i had the exact the issue so i just rename my project name from "admin-panel" to "adminpanel" without any space and then the flutter create . worked perfectly
I just ran into this as well, seems like this bug had been in the tool for a while...
I agree with the points above, we should be using the pubspec name as fallback instead.
I'll take a look at figuring out a test and fix for the underlying tool bug.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
Zazo032 commentedon Mar 23, 2020
This same issue happened to us with a directory like com.xxxxxxxxxx.app, the workaround I did was to rename the folder and delete the wrongly generated files in android/ and ios/.
jmagman commentedon Mar 24, 2020
flutter/packages/flutter_tools/lib/src/commands/create.dart
Line 392 in 685e9d1
jonahwilliams commentedon Mar 24, 2020
You need to pass
--project-namelike @jmagman says above. Is this not working?yjbanov commentedon Mar 24, 2020
It probably does, but it doesn't make sense to have to pass this option when adding web support to an existing project. The project name is right there in the
pubspec.yamlfile.yjbanov commentedon Mar 24, 2020
The other issue is that the error message is misleading. While it technically correctly states that
"xxxxx-xxxxxx" is not a valid Dart package name., it implies that "xxxxx-xxxxxx" is being used as a package name, which is wrong.AseemWangoo commentedon Jun 29, 2020
Can you try this
flutter create --project-name=xyz .
esDotDev commentedon Sep 1, 2020
Can we just have the run command just use the name as defined in .yaml or the module name?
I'm guessing a grand total of 0 people want to use the folder name as the name for their actual project. Especially as names change, and folders tend not to.
vineetjk commentedon Nov 8, 2020
just now i faced the same issue after cloning a repository from github and i found out that after cloning the repository the file name was having capital letters that is not supported by dart, so i just renamed the folder and tried the command
flutter create .and it worked.. i hope this helps to people facing the same problem as mine.19 remaining items
thealidev commentedon Nov 15, 2022
Easyest Way
Simply Create New Blank Project And Move "web" Folder To Your Projectninetynin commentedon Nov 15, 2022
That aint the easiest and best way
hmm maybe it might be but why when there's a command to do this..
I just feel like this is a solution that solves for temp puproses but not in a long run
martinezinsua commentedon Jan 9, 2023
Thank you very much!!
YawarOsman commentedon Apr 29, 2023
IDK if you fixed it or not, but i had the exact the issue so i just rename my project name from "admin-panel" to "adminpanel" without any space and then the
flutter create .worked perfectlysagarshende23 commentedon May 26, 2023
Thank you So Much Bro... Working :-)
navaronbracke commentedon Jun 21, 2024
I just ran into this as well, seems like this bug had been in the tool for a while...
I agree with the points above, we should be using the pubspec name as fallback instead.
I'll take a look at figuring out a test and fix for the underlying tool bug.
Fix project name fallback (#150614)
Fix project name fallback (flutter#150614)
github-actions commentedon Jul 17, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.