1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

こんなときありませんか?

Dartのコードを書いていて警告がでる。
例えばこんなとき
image.png

info: Use 'const' with the constructor to improve performance. (prefer_const_constructors at [untitled] lib\main.dart:22)

パフォーマンスのためにconstをつけるといいよって警告がでる。
ありがたいんだけどね...
しかも大抵は一個だけじゃなく沢山ある...

使い方

修正内容を確認する

dart fix --dry-run

一括で修正する

dart fix --apply

実行すると警告が出ていたところにconstが追加されます。
image.png

まとめ

dart fixはDartの警告のほとんど全部を自動で解決してくれます。
意外と知られていないのでぜひ使ってみてください!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?