Home > OS >  Change VS Code to auto-import files in flutter relatively
Change VS Code to auto-import files in flutter relatively

Time:01-29

So, here is the problem:

Whenever I am coding with Flutter and Dart, and I use a feature from another file, when I press Tab, VS Code will auto-import the file for me.

The thing is, VS Code will use the package import syntax, like import 'package:<project_name>/<file_path>';. But I prefer relative import syntax.

So, is there a setting I can change in VS Code for Dart to configure it to use relative imports by default?

Thanks!

CodePudding user response:

While importing, you can find both option by tapping on yellow bulb or pressing ctrl .

enter image description here

Another handy thing, using dart-import extension on Vs-code.

  •  Tags:  
  • Related