flutterdartvisual-studio-codekeyboard-shortcutscode-generation

VS Code Keyboard Shortcut for "flutter pub run build_runner watch --delete-conflicting-outputs "


Is there a possibility to run this command via a shortcut in vs code? Seems unnecessary work to type the command flutter pub run build_runner watch --delete-conflicting-outputs by myself every single time.

Context: This command is used for code generation in flutter and dart projects.


Solution

    1. Inside vs code press Ctrl + Shift + B / Cmd + Shift + B on MacOS.
    2. This popup appears vs code popup with build_runner commands
    3. Click the settings icon to the right of the watch command which opens the tasks.json
    4. Append --delete-conflicting-outputs to the command tasks.json
    5. Pressing Ctrl + Shift + B again now opens a popup with the full command vs code popup with build_runner commands including the changed command