Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>dart-importNew to Visual Studio Code? Get it now.
dart-import

dart-import

Luan

|
630,009 installs
| (20) | Free
Fix Dart/Flutter's imports
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

dart-import

CI Status Latest Release

A simple plugin for VSCode to change all Dart/Flutter imports to relative format.

Find it on the VSCode Marketplace.

Features

Run one of these from the Command Palette, or bind them as desired. Imports from a file's own package become relative, then imports are sorted (this needs the Dart extension) and the file is saved.

  • "Fix Imports" (dart-import.fix) fixes the current file.
  • "Fix All Imports" (dart-import.fix-all) fixes every package in the workspace, with a progress notification you can cancel. Large repositories take a while, as each file goes through the Dart analyzer.

Set dartImport.fixOnSave to also fix a file whenever you save it.

Monorepos work out of the box: each file uses the nearest pubspec.yaml above it. Only files inside a package's lib folder have their imports changed. Generated files (see dartImport.excludeGeneratedFiles) are skipped by "Fix All Imports" and fix on save.

Contribute

Any help is appreciated! Comment, suggestions, issues, PR's! Give us a star to help!

Setup

This is a regular vscode extension setup. You can use the scripts in the package.json file to test.

To setup, run npm i to download dependencies.

Then, you can run npm test to run the tests, make sure they are passing.

To test in your machine, run npm run package to create a new VSIX file, and then use vscode's built in command Extensions: Install from VSIX... (from command palette) to load your version.

In order to deploy, run npm run publish. If your PAT token is expired, go to this page to get a new one.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft