Visual Studio Code Settings for Flutter Project

We can have Flutter project specific settings for VS Code so that all developers who work on it have a consistent experience. Below is my settings.json file. Add this to the .vscode folder under your project root directory.

{
    "dart.debugExternalPackageLibraries": false,
    "dart.debugSdkLibraries": false,
    "dart.lineLength": 150,
    "[dart]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit",
            "source.fixAll": "explicit",
            "source.quickFix": "explicit",

        },
        "editor.formatOnSave": true,
        "editor.rulers": [
            150
        ],
        // disable built-in highlighting and use Dart's ability to highlight only exact references
        "editor.selectionHighlight": false
    },
    // always switch to debugging console when starting a debug session
    "debug.internalConsoleOptions": "openOnSessionStart",
    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true
}

I am using the ruler and line length as 150 instead of 80 so that we don’t have too much code wrapping. It makes code very unreadable in my experience.

Leave a comment