Keyboard Shortcut To Add Trailing Comma? (Flutter & Android Studio)

2,945

You can use the combination of End+,, which will add a comma at the end of the line you are currently editing.

If that is too cumbersome for you, you can also go to Edit -> Macros -> Start Macro Recording, then press the keys you want and then stop the recording in the bottom right corner.
Now, you also have the ability to go to Settings -> Keymap -> Macros and add Add Keyboard Shortcut to your macro.

Share:
2,945
Matthew Rideout
Author by

Matthew Rideout

I am an app developer. My backends are mainly built with the GraphQL implementation of NestJS, with TypeSCript. My frontends are mainly built with Flutter / Dart. I have extensive career experience with digital marketing, analytics, UX design, and consumer behavior. This allows me to take a holistic approach to app development, to develop great user experiences.

Updated on December 03, 2022

Comments

  • Matthew Rideout
    Matthew Rideout over 1 year

    I would love to be able to use a keyboard shortcut to add a comma to the end of the existing line or the closing paren of the widget I'm currently editing, without manually moving my cursor around.

    This would help with the code formatting a lot, so that I don't have to click or keyboard arrow my cursor to where I want to add the comma.

    Is there a keyboard shortcut for this?

    I am using the format code on save option in Android Studio under Languages & Frameworks -> Flutter -> Editor

    More Information On Using Trailing Commas with Flutter https://flutter.dev/docs/development/tools/formatting#using-trailing-commas

  • Nusatad
    Nusatad almost 3 years
    Is there any reason, why this is not done by dartfm?
  • creativecreatorormaybenot
    creativecreatorormaybenot almost 3 years
    @Datasun dart format does not have an opinion on trailing commas. It will format differently based on whether you add it or not. Different people prepare omitting it or including it in different places.