Right now in my Flutter project when I annotate a constructor parameter with @required
and forget it when instantiating the constructor, I get a light warning from my IDE that the parameter is required.
I would like this to show up as an actual error from the IDE. Is there a way in analysis_options.yaml
or somewhere else to set it as error instead of warning?
In analysis_options.yaml
add
analyzer:
errors:
missing_required_param: error
before
$ flutter analyze
Analyzing flutter_0_generic...
info • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 2.2s)
after
$ flutter analyze
Analyzing flutter_0_generic...
error • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 1.8s)
See also https://www.dartlang.org/guides/language/analysis-options#changing-the-severity-of-analysis-rules
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