Android Studio IDE Syntax Highlighting Breaks after a few minutes (macOSX)

Viewed 217

PROBLEM

The Android Studio IDE (macOSX) has issues with Syntax/Intellisense. I'm running Flutter/Dart on it to code and compile a Flutter app. I have the latest install to date and I have the latest flutter/dart sdks as of date.

If I create a new file and start working in it, something causes the syntax highlighting and intellisense to break. This appears to happen within minutes of opening up Android Studio. I have to close it and reopen it for it to resume. When it breaks, other files seem to keep their syntax highlighting, but it no longer updates if I work in them. It keeps old errors on the page regardless of the code I change. Is there a fix for this?

EDIT

I found the problem has to do with type definitions, particularly when defining a Future type for a class method.

REPRODUCE

  1. Open up your flutter project (doesn't matter what it is).
  2. Go to your services code (or code that works with Future).
  3. Create a new method with a future return type with a generic specified. Do this by hand, just start typing it in, do not copy paste: Future<List<asdfasdf>>.
  4. After writing Future<List< it should break. It should do it every time for you like it is for me.

If I'm not working with Future, it doesn't break. The way I'm getting around it is defining the method with the future before defining the generics. So I first write Future myMethod() async { } make sure the syntax is correct and there's no errors, then I go in and define the generic.

0 Answers
Related