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

Code suggestion for initState/dispose/setState no longer works in Flutter 3 #49027

Closed
stevemessick opened this issue May 16, 2022 · 21 comments
Closed
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@stevemessick
Copy link
Contributor

Original issue:
flutter/flutter-intellij#6167


With Flutter 3.0, code suggestion for initState/dispose/setState no longer works. It worked for Flutter 2.10.
This issue was found in both Windows(10) and Mac(12.3.1).

Steps to Reproduce
Start typing in ini.
Hit control-space for auto suggestions
Nothing comes up yet.
Image

(It worked in Flutter 2.10.x)
Image

The screenshots are for initState, but the same thing happens with dispose and setState.

Version info
`Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2019.1.2)
[✓] VS Code (version 1.67.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!


I can confirm that changing the Flutter SDK from 2.10.5 to 3.0.0 causes this issue. You need to be editing the definition of a class that extends State and start to type a new method definition by typing ini. Prior to the upgrade you would see a suggestion to create a method named initState(). After the upgrade there are no suggetions.

@bwilkerson

@stevemessick stevemessick added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label May 16, 2022
@bwilkerson
Copy link
Member

I believe that @scheglov has fixed this on HEAD. It might be worth filing a cherry pick request for it.

@ldsouza93
Copy link

I'm facing the same issue, anyone could fix it?

@srawlins
Copy link
Member

@scheglov do you think Brian is correct?

@scheglov
Copy link
Contributor

Yes.

@scheglov
Copy link
Contributor

@keybow007
Copy link

It still seems to be unresolved even with Flutter 3.0.1.

スクリーンショット 2022-05-21 5 55 53

(flutter doctor)

`Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.3.1 21E258 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2019.1.2)
[✓] VS Code (version 1.67.0)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

• No issues found!
`

@srawlins
Copy link
Member

We could consider this for a cherry-pick.

@Pynman
Copy link

Pynman commented May 24, 2022

Faced the same issues.

@jcollins-g jcollins-g added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Jun 1, 2022
@Nico3652
Copy link

Nico3652 commented Jun 2, 2022

This is also happening for a lot of classes var.
Ex : when typing " color: red, " the completion Colors.red is not found anymore

@vsmenon
Copy link
Member

vsmenon commented Jun 7, 2022

@srawlins - is this still an open issue? It looks like the fix landed and is being cherry-picked.

@srawlins
Copy link
Member

srawlins commented Jun 7, 2022

I think that's right. It looks like @scheglov filed the cherry-pick here: #49086, which has been marged and released.

@srawlins srawlins closed this as completed Jun 7, 2022
@keybow007
Copy link

keybow007 commented Jun 10, 2022

Thanks for fixing.

I just tried it with Flutter 3.0.2.

initState and dispose did code completion properly.

(initState / dispose in Flutter 3.0.2)
スクリーンショット 2022-06-11 x5 33 05

Unfortunately, however, code completion for setState does not seem to work yet.

(setState in Flutter 3.0.2 => no suggestion)
スクリーンショット 2022-06-11 5 33 39

(setState in Flutter 2.10.5 => work properly)
スクリーンショット 2022-06-11 5 41 20

Since setState is a very commonly used and important method, it would be helpful if it could be resolved as soon as possible.

Thanks.

@vsmenon
Copy link
Member

vsmenon commented Jun 10, 2022

@keybow007 - could you please create a new issue and link to here? Don't want that to get lost in a closed issue. Thanks!

@keybow007
Copy link

Thank for reply. I created a new issue.
#49233

@Nathan617
Copy link

Same here. setState and colors are not autocompleting anymore. Waiting for a fix

@bayatechllc
Copy link

bayatechllc commented Jun 25, 2022

Same here!! setState is not autocompleting.

@scheglov
Copy link
Contributor

See #49233 (comment)

@khanahsan
Copy link

Code suggestion for async/dispose/setState no longer works in Flutter 3.0.2 #106724

i'm still face this issue in Android Studio i use dart 2.17.3 version

@n-apps
Copy link

n-apps commented Jul 6, 2022

Can confirm. setState is not autocompleting in Android Studio (version 2021.2)

• Flutter version 3.0.4 
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 85684f9300 (6 days ago), 2022-06-30 13:22:47 -0700
• Engine revision 6ba2af10bb
• Dart version 2.17.5
• DevTools version 2.12.2

@Nathan617
Copy link

Just did the update to Flutter 3.0.5 for Mac native M1 (with Android Studio version 2021.2 native M1) and colors autocomplete as well as setState autocomplete work fine now

@n-apps
Copy link

n-apps commented Jul 14, 2022

Just did the update to Flutter 3.0.5 for Mac native M1 (with Android Studio version 2021.2 native M1) and colors autocomplete as well as setState autocomplete work fine now

Can confirm. Upgrading to 3.0.5 fixed it for me.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests