How to Convert all Absolute path to relative path in flutter import?

Viewed 303

I want to convert all absolute paths to relative paths in flutter without doing one by one. Is there any way to do so?

2 Answers

There's a tool available for that from Dart v2.12:

https://dart.dev/tools/dart-fix

In short:

First run with dart fix --dry-run to see what's going to change.

If satisfied with results, run dart fix --apply to apply all the changes seen in the dry run.

Finally, I am answering my own question. I found an awesome vs code extension called dart-import.

After installing this extension. you just need to open command pallet using ctrl+shift+P and search for fix all import and Enter.

enter image description here

Related