简体   繁体   中英

Intellij Flutter - Import via Alt+Enter not working

My team members and me often face the problem in Intellij that we cannot import some classes via Alt+Enter because Intellij hasn't indexed them successfully.

Our set up

We have different Flutter projects which belong and work together.

ProjectFolder:

  • our_project/customer_app

  • our_project/provider_app

  • our_project/server_app

  • our_project/model_app

Some of these projects have dependencies to other projects which are declared in the pubspec.yaml file.

Problem

Eg the customer_app has a dependency to the model_app . Now we add this new class in model_app such as class MyModel .

Later in the process we want to use MyModel inside of the customer_app . If we type something like MyModel() and try to press Alt+Enter it doesn't find the class immediately. (it works miracously only sometimes)

What we have to do then is to copy the path of MyModel and do the import manually. Which is often time consuming.

We even tried to run flutter packages get which also doesn't help to find this import of MyModel . Ideally we want that Intellij find the import automatically by indexing it without copying the path out of the other project.

This is a known issue and planned to be fixed eventually.

You can upvote https://github.com/dart-lang/sdk/issues/25820

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM