Flutter / Dart syntax highlighting is not working

Issue

The syntax of the dartcode in my flutter project is no longer being highlighted and cannot click the declarations or do autocomplete of code, like typing: StreamBuilder( and then click enter to create the widget for a streambuilder.

See example code below, where normaly, the different elements would be coloured:

example code

This problem occured after I installed intelliJ, I did this because I needed to write some javascript for firebase functions.

Tried this so far, with no luck:

  • deleting android studio and re-install it.
  • invalidate caches and restart.
  • restart analyses server
  • checked that dart and flutter has the right paths under ‘languages & frameworks’
  • created a new flutter project, here everything works just fine. but if i copy in my codebase the issue persists

Im using android studios latest version.

EDIT:

Apparently I have some issues after all with the plugins. But as seen in the picture, I’ve given the paths to both flutter and dart.

Its somehow related to intelliJ because when i click the links from the flutter doctor output it takes me to jetbrains website

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.3 20E232 darwin-x64, locale da-DK)
    • Flutter version 2.2.3 at /Users/jeffmayn/Desktop/Development/flutter
    • Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jeffmayn/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 15.0.1+9-18)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Connected device (2 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 93.0.4577.63

! Doctor found issues in 2 categories.
Process finished with exit code 0

enter image description here

enter image description here

Solution

None of the suggested solutions worked out for me. What I did was then:

  • create a new flutter project.
  • setup dart and flutter plugins.
  • copy in all my code, files, assets, etc. from the old project to the new.

Answered By – jeffmayn

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *