Flutter / Dart syntax highlighting is not working

1,135

Solution 1

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.

Solution 2

It's fine to use PAM for authentication, but separate the user accounts for the administrative access and applications on user-level like mail. You have to either separate the user database and authentication of dovecot and postfix from PAM, the system one's, or you have to create another system account you use for administration via SSH and not for mail.

The second option is very easy, just use adduser to create a new user, allow SSH login and sudo only for this user. Optionally require Public-Key-Authentication, so you won't need your password to log in remotely anymore (and it's not allowed). Changing the password system-wide for PAM is performed with passwd.

The other possibility is to change the authentication backend of dovecot's saslauth, configured in /etc/dovecot/conf.d/10-auth.conf.

Solution 3

There is a security flaw because you are using a privileged account (sudo account) to perform a task a normal user (without being privileged) would normally perform.

I would add a simple system account and use it to authenticate against roundcube to reach my emails.

Furthermore, I don't believe you needa system account for this. There must be another way to manage accounts (such as accounts stored in a database, (MySQL or LDAP)). The fact is, this is simpler for a basic installation to lay on system authentication, and this may fit a single usage. If you have hundreds of e-mail users, you would certainly not use system accounts. you may want to read this.

Solution 4

I think reinstalling Flutter and Dart plugin to Android Studio can help. Syntax highlighting is plugins' job.

Solution 5

The solution of yoppuyoppu worked for me, but as he mentioned, only for the selected files.

So here is a small addition that makes it work for all .dart files:

In the "Register New File Type Association" window you can change the File pattern to "*.dart".

enter image description here

And of course select Dart as shown.

That way all files ending with ".dart" will be associated with Dart.

Share:
1,135

Related videos on Youtube

jeffmayn
Author by

jeffmayn

Updated on January 01, 2023

Comments

  • jeffmayn
    jeffmayn over 1 year

    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

    • Benyamin
      Benyamin over 2 years
    • jeffmayn
      jeffmayn over 2 years
      @Benyamin I also deleted intelliJ. Only using Android Studio now
    • Benyamin
      Benyamin over 2 years
      almost no difference, check it.
    • Developer Extraordinare
      Developer Extraordinare over 2 years
      You installed the plugins for flutter and dart already, right?
    • Developer Extraordinare
      Developer Extraordinare over 2 years
      And is there anything useful if you type flutter doctor from the terminal?
    • jeffmayn
      jeffmayn over 2 years
      @developerextraordinare yes.. and can even compile and run on android devices.. will update my question
    • ritik kumar srivastava
      ritik kumar srivastava over 2 years
      sometimes the system is slow so it takes time for the linting and analyzer to work by default to enhance this you can add linter and analyzer explicitly this would get this boosted up. PS. you can also increase the IDE max heap size. Preferences->Appearence & Behaviour -> System Settings -> Memory Settings
    • jeffmayn
      jeffmayn over 2 years
      @developerextraordinare made an edit to my question.
    • jeffmayn
      jeffmayn over 2 years
      @ritikkumarsrivastava already at max heap size of 2gb
    • ritik kumar srivastava
      ritik kumar srivastava over 2 years
      can you try adding your own linting in the project.
  • speendo
    speendo almost 9 years
    thanks for your response! For the moment we have only 4 users on the server. I didn't think it might pay to go too deep into LDAP or a different user database. Do you think so?
  • philippe
    philippe almost 9 years
    Creating another account while conserving a sudo-user reaching emails does not sound like a good idea. Furthermore, speendo never speaks about SSH, public-key-authentication looks like off-topic.
  • sebix
    sebix almost 9 years
    @philippe Thanks, I added that sudo has to be configured accordingly. If public-key is required to administer the server remotely, the password of the user account is not enough to get access to it.
  • speendo
    speendo almost 9 years
    in fact I do use ssh public-key authentication but I am indeed looking for a solution where I can use a password as well.
  • speendo
    speendo almost 9 years
    this looks like a great solution. However, I have to read it through and understand it first - it doesn't look too simple...
  • philippe
    philippe almost 9 years
    @sebix: Ok, I didn't get your point. This is clearer indeed now. SSH works better with key authentication; and regarding this aspect, sebix gets the point: enforcing public-key authentication avoids connexion even if password leeks
  • jeffmayn
    jeffmayn over 2 years
    I've tried that. If you look at my flutter doctor it says the plugins for dart and flutter is missing and that I can download them from jetbrains.. so somehow android studio is still thinking its using intelliJ. Don't know how to change this, so now I will backup my codebase and pull back to an recent commit before I installed intellij, then copy back the codebase. hopefully this will work
  • Ekrem Kamaz
    Ekrem Kamaz over 2 years
    There is nothing wrong because Android Studio is already based on IntellijIDEA. This can be helpful for removing plugins.
  • jeffmayn
    jeffmayn over 2 years
    now Ive tried removing all plugin like described in that link, still did not work. even tried completely removing all traces of android studio from my system, installing a fresh version and opening my project again. Same issue :/ starting to suspect its the 2020.3 version doing some weird stuff
  • Community
    Community over 2 years
    Please provide additional details in your answer. As it's currently written, it's hard to understand your solution.