Recently updated to Android Studio 3.5 and now my code is full of annoying yellow lines with warning that I would like to suppress.
However, when trying clicking on the yellow bulb and use the solution proposed, it does not work, it just adds a comment-like line that has no effect, example:
When getting this warning:
"Use => for short members whose body is a single return statement"
Yellow bulb just adds a line above like this:
// ignore: prefer_expression_function_bodies
Any permanent solution to these annoying warnings in Android Studio?
The Dart analyzer does this and the ignore
comment should suppress the warnings. By the way, this should not have anything to do with your Android Studio version.
There are two main ways to suppress specific lints "globally":
ignore_for_file
comments. This is analogous to ignore
, but works for the whole file.// ingore_for_file: prefer_expression_function_bodies
analysis_options.yaml
file. You can always view documentation for all the lints, e.g. for prefer_expression_function_bodies
, and any lint can be excluded in your analysis_options.yaml
file (it should be placed in the same directory as your pubspec.yaml
):linter:
rules:
prefer_expression_function_bodies: false
Learn more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With