0

Whatever I auto-import (CTRL+.) gets imported using the "package:" syntax. That's fine when it's a package, but it's bothersome when I'm trying to import local files, and my understanding is that it's not best practice either; local files should be imported with a standard filepath.

For example, if I've got a utility I've written that I want to import into main.dart, the import should look like:

import 'utilities/my_utility.dart';

Instead, it's coming out as:

import 'package:my_app/utilities/my_utility.dart';

  • 1
    Already answered here [Flutter imports: relative path or package?](https://stackoverflow.com/a/66188522/5882307) – OMi Shah Aug 21 '23 at 10:50

1 Answers1

0

You can add the

dart-import

extension from the extensions section in vs code. You can add the page you want to import by clicking the yellow light bulb in any path you want.

Output: enter image description here

MobileDev
  • 214
  • 7