0
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?

flutter analyzeでエラーになるものをVSCode上で赤波線をつけたい

Posted at

はじめに

こんにちは、エンジニアのkeitaMaxです。

flutter analyzeでエラーになるものをVSCode上で赤波線をつけるように修正しようと思います。

やりたいこと

前回VSCodeでダブルクォーテーションを使用した時にflutter analyzeをするとエラーにするようにしました。
VSCode上でみると↓のように青波線がでているのを赤波線にしたいと思います。

スクリーンショット 2025-11-06 20.19.41.png

結論

analysis_options.yamlにエラーとなるように記述すればいいだけでした。

analysis_options.yamlに書いたものはデフォルトでinfoレベルでの指摘になるらしいです。

  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    prefer_single_quotes: true  # Enforce single quotes across the codebase

なので、以下のようにエラーレベルで出すことを明示的に書くことで赤波線になります。

  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    prefer_single_quotes: true  # Enforce single quotes across the codebase
analyzer:
  errors:
    prefer_single_quotes: error

これを設定して対象箇所を見てます。

スクリーンショット 2025-11-06 20.24.13.png

赤波線になりました。

ちなみにerror部分をwarningとすると黄色波線になります。

スクリーンショット 2025-11-06 20.24.56.png

おわりに

この記事での質問や、間違っている、もっといい方法があるといったご意見などありましたらご指摘していただけると幸いです。

最後まで読んでいただきありがとうございました!

0
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
0
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?