Flutter – how to change dart line length in vscode when formatting dart files

coding-styledartflutterformattingvisual-studio-code

i'm using VS Code for flutter development and one issue i have is code formatting (styling) which is not as customizable as it is in android-studio. my problem is that each time vs code saves dart files it will break my lines very short like below:

var tuple =
       settings.arguments as Tuple3<String, int, Field>;

obviously this is what i want :

var tuple = settings.arguments as Tuple3<String, int, Field>;

how can i solve this problem?

Best Answer

You need to change 2 settings in settings.json:

"dart.lineLength": 150,
"[dart]": {
    "editor.rulers": [
        150
    ],
}

If you do not change the second one, you'll still see the vertical "ruler" at 80 chars width.