Android Studio - Flutter Plugin - Moving method to another file by refactoring
Asked Answered
V

1

8

Why I cannot (?) move a method from one Dart file to another using Android Studio and Flutter Plugin? My file is getting big and I decided to refactor it by separated some Widget build methods to their own files. I started by selecting one of the methods, performing the Android Studio's refactor command and click move as I always did with java. But looks like the only option is to move the actual Dart File to another Directory.

It would be nice if I could move the method and the entire tree to another file, and some others refactoring options.

Is there any way to facilitate this type of refactoring?

enter image description here

enter image description here

Android Studio 3.3 RC 2 Build #AI-182.5107.16.33.5160847, built on December 3, 2018 JRE: 1.8.0_152-release-1248-b01 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.15.0-39-generic

Vries answered 24/12, 2018 at 23:25 Comment(0)
D
4

This is a open feature request of the dart sdk. Unfortunately, for more than two years it did not find much attention. https://github.com/dart-lang/sdk/issues/30310

Danaides answered 27/2, 2020 at 12:4 Comment(2)
Refactoring a method from a destination file to a source file should be a fundamental refactor in any IDE in my opinion. This is disappointing, cutting and pasting code is error prone and has no place in a modern IDE.Valentine
This is available on the Visual Studio plugin, when experimental refactorings are enabled. It seems to work as expected, and I have done a lot of refactorings on VS Code. I still prefer IDEA for development, but this specific feature is still not available for IDEA.Karwan

© 2022 - 2024 — McMap. All rights reserved.