import_converter 1.0.0+2 copy "import_converter: ^1.0.0+2" to clipboard
import_converter: ^1.0.0+2 copied to clipboard

A CLI program to convert package imports to path imports in Dart projects.

Import Converter #

A Dart command-line tool for converting package imports to path imports and vice versa in a Dart project.

Features #

  • Automatically scans all .dart files within the project and converts package imports to path imports.
  • Supports reverting path imports back to package imports.
  • Excludes processing files in the test folder.
  • Retrieves the project name from the pubspec.yaml file.

Installation #

Activate the import_converter package globally:

dart pub global activate import_converter

Running #

  1. Convert package imports to path imports:
import_converter --path /path/to/your/dart/project
  1. Convert path imports back to package imports:
import_converter --path /path/to/your/dart/project --revert

Command Line Options #

  • --path or -p: The path to the directory containing your Dart project.
  • --revert or -r: Revert path imports back to package imports. By default, the program converts package imports to path imports.

Limitations #

  • This tool assumes a standard Dart project structure with a lib folder containing the source code and a pubspec.yaml file.
  • It does not currently support custom import prefixes or aliasing.
1
likes
130
pub points
7%
popularity

Publisher

unverified uploader

A CLI program to convert package imports to path imports in Dart projects.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (LICENSE)

Dependencies

args, path, yaml

More

Packages that depend on import_converter