Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatelessWidgets are not recognized as widgets and can't be moved to a file #273

Open
RyanParkGH opened this issue Jan 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@RyanParkGH
Copy link

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

  1. Locate a class that extends StatelessWidget
  2. Right-click on the widget's class name
  3. Select Refactor > Extract Widget to File
  4. 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

@RyanParkGH RyanParkGH added the bug Something isn't working label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant