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 3 years have passed since last update.

pubspec.yamlのワーニングを無効化する方法

1
Posted at

本記事では、pubspec.yamlで出てくるワーニングを無効化する方法を紹介します。

基本的には、ワーニングは無視しない方がいいです。
ただ、以下のような場合、無視したくなることが起きます。

  1. GitHubに上げたくない画像があり、その画像をgitignore。
  2. CI (GitHub Actions)でflutter analyzeを実行
  3. GitHub上では画像が存在しないため、pubspec.yamlのasset_directory_does_not_existのワーニングでCIが失敗

CIを成功させるためには、ワーニングを無視するしかない、という場合ですね。
このような場合にワーニングを無効化する方法を紹介します。

無効化する方法##

analysis_options.yamlに以下の文を追記します。

analysis_options.yaml
analyzer:
  errors:
    無視したいワーニング名 : ignore

上の例でいうと、以下のようになります。

analysis_options.yaml
analyzer:
  errors:
    asset_directory_does_not_exist : ignore

これで、ワーニングが無効化されました。

まとめ##

今回はpubspec.yamlで出てくるワーニングを無効化する方法を紹介しました。
CIを使っていると悩ましい状況多々あると思いますが、
今回の情報がお役に立てれば幸いです。

参考##

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?