Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix auto-fixable problems on VSCode with Flutter?

I've updated pedantic package and ended up 1K+ problems. Many of them are prefer_single_quotes or unnecessary this etc. They are one click away to fix. I think eslint or some other tools can do that within the VSCode.

Is there a way to do it with Flutter projects? I find dartfix package but says “No recommended changes” after running it. What I want to do is fix all the auto-fixable problems on the problems tab.

dartfix on pub.dev

like image 563
mirkancal Avatar asked May 10 '20 08:05

mirkancal


People also ask

How do you solve the const problem in Flutter?

Simply right click on any of the warning in the problems tab in vscode and choose Add const modifiers everywhere in the file.

Is VS Code good for Flutter?

VS Code is a lightweight editor that has great Flutter support, good extensibility and sees widespread use across the developer community.

How do I enable VS Code flutters?

Install the Flutter and Dart pluginsStart VS Code. Invoke View > Command Palette…. Type “install”, and select Extensions: Install Extensions. Type “flutter” in the extensions search field, select Flutter in the list, and click Install.

Which Visual Studio is best for Flutter?

The two main IDEs for Flutter development are Visual Studio Code and Android Studio. Visual Studio is better for team collaboration, but it doesn't run on Linux.


1 Answers

Not sure if you have tried the built in fixes using dart fix.

Use dart fix --dry-run to see suggested changes and dart fix --apply to apply them.

https://dart.dev/tools/dart-fix

like image 103
James Avatar answered Nov 01 '22 11:11

James