Android Studio - 'constants.dart' file becomes a .txt file

Viewed 79

This has only become a problem in the past week. I've had many Flutter projects in Android Studio over the past year, and nearly every project has a constants.dart file that behaves appropriately as a .dart file.

However, the exact filename constants.dart is instantly converted to a .txt file as of last week. If I name it anything else, such as constantsA.dart then it remains a .dart file and behaves as expected.

I've searched in vain online to find out why this is happening, but I can't find any info. I'm running the latest versions of Android Studio, Dart, and Flutter.

1 Answers

Select the file in the project navigator, then go to menu File > File properties > Associate with file type...

enter image description here

Select "Dart" and the fille will be opened as dart file again.

enter image description here

Related