question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot override missing methods on newly created StatefulWidget

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
AylanBoscarinocommented, May 20, 2020

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.

7reactions
AhmedElshimy1998commented, May 16, 2022

issue still in 2022

Read more comments on GitHub >

github_iconTop Results From Across the Web

Created a Stateful widget and not being able to setstate()
The stateful widget is an abstract class like the stateless widget. In the case of the stateful widget, you have to override the...
Read more >
StatefulWidget class - widgets library - Flutter - Dart API docs
A widget that has mutable state. State is information that (1) can be read synchronously when the widget is built and (2) might...
Read more >
Some Widely Used Override Methods in Flutter - ProAndroidDev
Overriding of initState() method performs initialization which depends on the location at which this object was inserted into the tree (like ...
Read more >
Creating a Base Screen in Flutter using an abstract class and ...
Create an abstract class that extends a stateful widget. ... to create missing methods so we have added the missing overrides to return...
Read more >
The difference between stateless and stateful widgets in Flutter
A stateless widget cannot change its state during the runtime of a Flutter application. That means a stateless widget cannot be redrawn while ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found