Omri1100
Omri1100

Reputation: 363

Autocomplete not working correctly in Android Studio with Flutter - First suggestions are irrelevant

I installed Flutter and Android Studio. I ran flutter doctor - Flutter doctor

I have the Dart plugin installed - v191.8593. image

When I press Ctrl + Space at a very obvious place the AutoComplete do not suggest the right suggestions. Example:

View animation here

As you see the first suggestion are not of type ScrollPhysics and are out of context, and after I scroll down, there are ScrollPhysics suggestions, but they are after some scrolling.

Upvotes: 26

Views: 25902

Answers (11)

TryCatchFinally
TryCatchFinally

Reputation: 51

Disabling and enabling both dart and flutter plugin fixed it without restarting AS. AS will ask when you first disable but ignore and enable again.

  • Go to Android Studio > Settings > Plugins.
  • You can select Install Tab to quickly see installed plugins.
  • Uncheck dart and flutter.
  • click apply.
  • Check dart and flutter.
  • Click apply.

Buy me a beer.

Upvotes: 0

deepraj singh
deepraj singh

Reputation: 11

You need to add path of your project here for Autocomplete to work or disable it, easiest way is to let auto completes the process

Upvotes: 0

Umang Doshi
Umang Doshi

Reputation: 1

First check in Android Studio > Settings > Editor > Live Templates that is it empty or not.

If it's empty then Make sure you have installed latest version of android studio and autosuggestion is on.

For checking if autosuggestion is on or not follow the steps given below; Android Studio > Settings > Editor > General > Code Completion

And finally follow below steps: Go to Android studio > File > Manage IDE Settings > Restore Default Settings

Upvotes: 0

Hardik Khunt
Hardik Khunt

Reputation: 51

Remove Flutter And Dart Plugins and reinstall it will work for suggestion like stateless and stateful widgets if this don't work then remove all the plugins and reinstall will do!

  • I remove all of my plugin which I added my self don't remove plugins which was install by android studio IDE.

Upvotes: 2

T.Smith
T.Smith

Reputation: 171

Enable scope Analysis I fix this by enable the Scope Analysis, at Dart Analysis-> Set Icon-> CheckBox.

Upvotes: 16

Shyleez
Shyleez

Reputation: 1

I had the same problem and solved it by changing the first letter of my project directory's name from capital letter to lowercase letter. Example : "My_project" => "my_project"

The solution was found there : https://github.com/flutter/flutter-intellij/issues/5978

Upvotes: 0

genericUser
genericUser

Reputation: 7208

In my case, restart android-studio worked.

Upvotes: -2

Jobin
Jobin

Reputation: 496

Restart Dart Analysis Server :-

  1. Navigate to Dart Analysis tab at bottom.
  2. Click Restart Icon (red colored icon on top left corner of Dart Analysis Window)
  3. Wait for dart analysis to finish.

If it does not work, try this :-

  1. Delete .packages and pubspec.lock files present in your project folder
  2. run flutter pub get

Upvotes: 17

Nux
Nux

Reputation: 7098

This problem can be fixed by one of the following

  1. Invalidate caches and Restart fixed my problem. Goto

File-> Ivalidate caches / Restart -> Invalidate and Restart

  1. Restart Dart Analysis Server. Follow the pic below enter image description here

Note all above solutions works but are not permanent as it appears there is bug in latest dart Analysis server you can follow subscribe to this reported issue for more updates

Upvotes: 32

Hashmitha S
Hashmitha S

Reputation: 1

if you type stful it gives you the autocompletion of stateful widget for you. or you have to go to

> Setting -> Editor -> Live Templates ->(choose)Flutter->(tick the option)stful

This is the image Depicting the Steps

Upvotes: 0

Mina Farid
Mina Farid

Reputation: 5887

In my case, I run in android studio terminal:

 flutter upgrade

Upvotes: 3

Related Questions