Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio not recognising a file if a specific name is given

Using android-studio for flutter development. After creating a new flutter app I created another file named

home.dart

But android-studio is not recognizing the file. The page won't show autocomplete or anything. can see that <code>home.dart</code> don't have the globe symbol before the file name.

Also I can see that home.dart don't have the globe symbol before the file name(in left side like other files). If I put any other file name it works fine. Could someone find what's the issue?

Update

I think its some sort of bug. I even tried creating a fresh project and tried the same. If I put another name it works fine(I tried hom.dart and it works). But if I rename it as home.dart it is having this weird error.

Thank you

like image 454
Abhilash Avatar asked Dec 02 '22 09:12

Abhilash


1 Answers

You have associated a different file type to that specific file by creating it as a regular file (right click -> New -> File) which has no implied type and instead shows a list of types to select from. You may have just clicked Next without changing the default selection of file type of 'Text'. Renaming the file afterwards may or may not change its type depending on the version of Android Studio.

In order to fix it, open settings (Ctrl + Alt + S), go to Editor -> File Types, scroll down and select 'Text' from the list of file types, select your file from the list at the bottom, and click the minus (-) sign to remove it. Your file should no longer be associated to a type of 'Text' - I'm not sure whether it will automatically be reassigned based on its extension or not, but you should now be able to delete it and create it again with the same name without automatically setting itself back to 'Text'

like image 192
Ovidiu Avatar answered Dec 03 '22 22:12

Ovidiu