6

I recently started working on Flutter/Dart, I like the flutter autoformatting on-save, but one thing might or might not be related is the code wrapping for long code even if code is still fitting my 4k editor window.

Is there a way to prevent new line but keep the comma auto format?

Thanks

example of code auto formatted to new line

.vscode/settings.sjon

0

1 Answer 1

22

Follow the instructions below:

  1. Open Settings.
  2. Expand Extensions and click Dart & Flutter on the left.
  3. Find Dart: Line Length.
  4. Change it to the value you want.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Finally, a lifesaver! It's actually a dart setting instead of a vs code setting.
You might also want to change the value of parameter "editor.rulers" in settings.json, in the "[dart]" section, in order to have the corresponding ruler displayed in the editor.
Does anyone know how to do this in Android Studio? Settings > Editor > Code Style > Dart > Line length only moves the vertical guide. Dart still breaks the line after 80 chars. I also tried adding - lines_longer_than_80_chars to the rules in analysis_options.yaml as suggested here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.