Ranjit Shrestha
Ranjit Shrestha

Reputation: 762

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

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

Upvotes: 3

Views: 1160

Answers (2)

Ranjit Shrestha
Ranjit Shrestha

Reputation: 762

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

Upvotes: 1

rexxar
rexxar

Reputation: 1801

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.

Upvotes: 1

Related Questions