3
votes

I've created a Flutter app in Android Studio and I want to change the name of the "lib" directory (in which Dart source files reside) to "src".

However when I do that, the import to 'package:/main.dart' fails. How can I change that?

I changed the path in the .iml file, and the project compiles and runs, but this test file still shows an error.

1
You could depend from the lib/main.dart file to the src folder.Bostrot

1 Answers

4
votes

This name is hardcoded and there is no way to change it.
The whole pub package system depends on that directory name.

There is also a convention that tools like the analyzer support code in lib/src being considered package-private when not exported by files in other directories in lib/.