4
votes

When I try to move files from one directory to another, Android studio auto-search and changes imports of that file in other files which is really convenient.

But in Flutter when I do this it starts the file import from "file//...path" in place of "package:...path"

i.e

import 'file:///C:/Users/my_name/AndroidStudioProjects/path-to-file/newpage_component.dart';

in place of

import 'package:path-to-file/newpage_component.dart';

This is really annoying and I have to change it in every file manually.

The biggest problem arises if you are using build_runner lib. It doesn't run watch command if there is any import starting from 'file://'

2

2 Answers

0
votes

Update Android Studio. Then update your Flutter and Dart plugins. Click Help > Check for updates.

0
votes

Looks like it was fixed in March 2021 in this issue: https://github.com/dart-lang/sdk/issues/43602 But according to the dart plugin version history https://plugins.jetbrains.com/plugin/6351-dart/versions, it's only compatible with Studio build 211.6556+.

The latest Studio release candidate is build 202.7231092

The latest Canary is Arctic Fox 2020.3.1.14

I don't know Studio's new naming scheme relates to the build numbers listed on the Jetbrains plugin page, but certainly for now it seems we can't get the update.