Even with the CTRL+SPACE shortcut, the options I get are nowhere near relevant to the code.

I created a new file named questions.dart in the lib folder along with main.dart. In main.dart the code autocomplete works fine but in question.dart, it doesn't. Also, the syntax is not getting highlighted as well in the new file.

For questions.dart https://i.stack.imgur.com/aCHkJ.png

For main.dart https://i.stack.imgur.com/kJ96q.png

Solution 1: ambiguous58

Restart the Dart Analysis Server. If that doesn't work, restart your IDE.

This happens to me occasionally. I believe it's an issue with the Dart Analysis Server. Usually, restarting the Dart Analysis Server fixes it.

To restart the Dart Analysis Server. Press ctrl + shift + p. Then search look for a command called Dart: Restart Analysis Server. If it doesn't work restart your IDE.

Solution 2: Matheus Neumann

I'm facing the same issue here. I managed to solve it by switching flutter channel from master to beta. Now autocomplete works, but sometimes things still get crazy.