You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the refactor extract to file does not work on classes that extend StatelessWidget, the following error message occurs:
'Can only extract a widget expression or a method returning a widget'
Steps to Reproduce
Locate a class that extends StatelessWidget
Right-click on the widget's class name
Select Refactor > Extract Widget to File
See error message above
Expected behavior
The StatelessWidget is movable to a file, StatelessWidget extends Widget thus any class extending StatelessWidget is a Widget itself. If this is the not the case, the usefulness of the extraction refactor is extremely limited as all Widgets extracted from a build() are either StatefulWidget or StatelessWidget.
Screenshots
N/A
Software used
Android Studio Hedgehog | 2023.1.1 Patch 1
Build #AI-231.9392.1.2311.11255304, built on December 26, 2023
Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.2.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
com.intellij.marketplace (231.9392.3)
Dart (231.9411)
ru.adelf.idea.dotenv (2023.1)
io.flutter (77.1.2)
de.mariushoefler.flutter_enhancement_suite (1.7.1)
Additional context
The text was updated successfully, but these errors were encountered:
Describe the bug
Using the refactor extract to file does not work on classes that extend
StatelessWidget
, the following error message occurs:'Can only extract a widget expression or a method returning a widget'
Steps to Reproduce
StatelessWidget
Expected behavior
The
StatelessWidget
is movable to a file,StatelessWidget
extendsWidget
thus any class extendingStatelessWidget
is aWidget
itself. If this is the not the case, the usefulness of the extraction refactor is extremely limited as allWidgets
extracted from abuild()
are eitherStatefulWidget
orStatelessWidget
.Screenshots
N/A
Software used
Additional context
The text was updated successfully, but these errors were encountered: