Flutter-intellij: Cannot override missing methods on newly created StatefulWidget

Created on 8 May 2018  Â·  6Comments  Â·  Source: flutter/flutter-intellij

Steps to Reproduce

If I type this:

class StatefulTest extends StatefulWidget {
}

Into a dart file, I get an analyzer error on the "StatefulTest":
image

This makes sense. But when I select "Generate...>Override Methods...", or hit "Ctrl-O", (with my cursor on the class name), I get this:
image

I'd really like to be able to easily create a new widget by just typing the class declaration, and then making skeletons of all the missing overrides.

Version info

[✓] Flutter (Channel switcher_perf, v0.4.1-pre.32, on Linux, locale en_US.UTF-8)
    • Flutter version 0.4.1-pre.32 at /usr/local/google/home/gspencer/code/flutter
    • Framework revision 7cc7263ef8 (4 days ago), 2018-05-04 09:23:45 -0700
    • Engine revision 20b286dd42
    • Dart version 2.0.0-dev.53.0.flutter-e6d7d67f4b

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.2)
    • Android SDK at /usr/local/google/home/gspencer/Android/Sdk
    • Android NDK at /usr/local/google/home/gspencer/Android/Sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.2
    • ANDROID_HOME = /usr/local/google/home/gspencer/Android/Sdk
    • Java binary at: /opt/android-studio-with-blaze-3.0/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    • All Android licenses accepted.

[✓] IntelliJ IDEA Community Edition (version 2018.1)
    • IntelliJ at /opt/my-intellij-ce-2018.1
    • Flutter plugin version 24.1.2
    • Dart plugin version 181.4892.1

[✓] Connected devices (1 available)
    • Nexus 6P • 84B7N15A07007628 • android-arm64 • Android 8.1.0 (API 27)

• No issues found!

Most helpful comment

This issue wasn't fixed yet.

A problem that is quite common to me when I extend a custom created class (like BaseViewModel for example) and want to override any specific method (Ctrl + O) the IDE says that no method where found to override.

All 6 comments

/cc @scheglov

Generate... > Override Methods... is implemented in Java in Dart plugin and is old code.
Ideally we should replace it with requesting members data from Analysis Server.
@jwren have you started working on this, or I can steal it? :-)

For you using Quick Assist (Cmd + Enter) might be a better choice.
It will do exactly what you need - add all missing overrides.

image

image

@scheglov - Go for it. Integration from DAS into the generator wasn't obvious to me into the Generator IJ framework. Alt+Enter on the error from the DAS, does the right thing so it hasn't been prioritized.

One difference between the Ctrl/Cmd-I and Alt/Cmd-Enter way is that I have to actually have the cursor on the class name to have the context menu appear, as opposed to anywhere inside of the class declaration.

This issue wasn't fixed yet.

A problem that is quite common to me when I extend a custom created class (like BaseViewModel for example) and want to override any specific method (Ctrl + O) the IDE says that no method where found to override.

This issue still exists in 2020.
When is it going to be fixed?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moodi1999 picture moodi1999  Â·  4Comments

willlarche picture willlarche  Â·  3Comments

daniel-v picture daniel-v  Â·  4Comments

KevinTheGray picture KevinTheGray  Â·  3Comments

DaveShuckerow picture DaveShuckerow  Â·  3Comments