18

enter image description here

I have tried upgrading flutter to the latest version. I am still getting the same error.

Chirag Sondagar
  • 427
  • 1
  • 4
  • 15
Shehzadahmad_
  • 199
  • 1
  • 1
  • 3

5 Answers5

28

I was getting the exact same error.
After Renaming my working directory as per the naming convention attached by the Flutter team here which @Rushikesh just mentioned. It worked for me..
The reason is that the Flutter SDK uses directory/folder names as packages names and I was using a hyphen in my directory name. In your case mybmicalculator or my_bmi_calculator might work instead of myBmiCalculator .
Give it a try, that might be one of the errors.

12

Package names should be all lowercase, with underscores to separate words, just_like_this. Use only basic Latin letters and Arabic digits: [a-z0-9_]. Also, make sure the name is a valid Dart identifier -- that it doesn't start with digits and isn't a reserved word.

see this - https://dart-lang.github.io/linter/lints/package_names.html

Rushikesh Talokar
  • 1,515
  • 4
  • 16
  • 32
2

I think your app's folder name has some capital letters, any digit at the start, or something like that. I faced this as my app's folder name had capital letters and when I used all small letters the problem was solved.

Muhammad Umair Saqib
  • 1,287
  • 1
  • 9
  • 20
0

Don't use a capital letter at the beginning of your app name like this: flutter create Appname. You may encounter an error if you create a Flutter app with a capital letter at the beginning. To avoid errors, always use this method: flutter create appname, without a capital letter at the start.

-1

in my case the android folder is missing and flutter create . is also not working how i fixed my problem is .

  1. copy the android folder from any project.
  2. re-open the project and everything works fine