Alvin John Babu
Alvin John Babu

Reputation: 2070

How to increase the width of the code line in Android studio?

I am using Android studio to develop a flutter app, when I click reformat code with dart format it breaks in unpleasing format. enter image description here

Even though there is lot of space it breaks the line, how can i increase the line width?

Upvotes: 34

Views: 9320

Answers (5)

Alvin John Babu
Alvin John Babu

Reputation: 2070

I solved this issue by changing Settings -> Editor -> Code Style -> Dart -> Line length to 150

Upvotes: 76

Chris Veagle
Chris Veagle

Reputation: 21

For VS Code:

File -> Preferences -> Settings -> Dart&Flutter: Dart: Line Length

Upvotes: 2

Cevin Ways
Cevin Ways

Reputation: 984

Go to settings -> Editor -> Code Style -> Dart, you can change line length to what ever value you want, but based on Effective dart style, it's better to avoid lines longer than 80 characters. see this docs https://dart.dev/guides/language/effective-dart/style

enter image description here

Upvotes: 7

Bryan Neuberger
Bryan Neuberger

Reputation: 208

FOR MAC OS:

Android Studio -> Preferences -> Editor -> Code Style -> Dart -> Line length: int

Upvotes: 10

Thomas Hüttmaier
Thomas Hüttmaier

Reputation: 117

I'm not sure how to change the settings, maybe with an Android Studio plugin, but as described in the Dart docs you should avoid lines with more than 80 characters of code. Try to structure your code a bit then you have more overview instead of squeezing everything in one method, widget or whatever together

Link to Dart docs

Upvotes: 2

Related Questions