Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 788
Omri1100 Avatar asked Jan 21 '20 20:01

Omri1100


People also ask

How to autocomplete works in flutter?

It shows how to autocomplete will work in your flutter applications. It shows when users tap on textfield then will show down some suggestions and yow will also pick up those suggestions. It will be shown on your device.

Does autocomplete suggest the right suggestions when pressing Ctrl + Space?

I have the Dart plugin installed - v191.8593. When I press Ctrl + Space at a very obvious place the AutoComplete do not suggest the right suggestions. Example: 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.

How to tell the autocomplete widget when the client chooses an option?

Likewise, the Autocomplete widget should be advised when the client chooses an option. To tell the Autocomplete widget, call the AutocompleteOnSelected function and pass the selected item as the contention. The beneath model makes a custom view for the options by making a ListView wrapped as the child of a Container.

How do I display autocomplete on my Device?

It will be shown on your device. To utilize Autocomplete, you need to call the constructor underneath: The Autocomplete class itself has a generic kind T expands Object. That implies the choice item can be any kind of object, not a string. > key: The widget's key, used to control how a widget is replaced with another widget.


3 Answers

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

like image 199
Nux Avatar answered Oct 16 '22 12:10

Nux


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
like image 9
Jobin Avatar answered Oct 16 '22 14:10

Jobin


In my case, I run in android studio terminal:

 flutter upgrade
like image 2
Mina Farid Avatar answered Oct 16 '22 12:10

Mina Farid