Friday, January 15, 2021

Dart Linting Tutorial

 Dart Linting Tutorial
Nobody cares about code quality,  until they feel the consequences of this negligence. Keeping the quality of your code high is absolutely crucial, especially when you work on a team. Every app is built by writing individual statements first so before even discussing high-level design patterns, you should start with project cleanliness from the ground up - by configuring more advanced linting.
......................................................................................................................................................................................................................................
Example :#1 [ create a yaml file and use it ]
Create a new file with same name
analysis_options.yaml

code here

analyzer:
  errors:
    missing_required_param: error


main.dart


Note
The possible values for the severity are ignore, info, warning and error.
we can write    
 missing_required_param: info
 missing_required_param: warning

Happy Coding :)
.....................................................................................................................................................................................................................................
Example :#2 [  install lint  and use it ]

https://pub.dev/packages/lint/install
Install
  lint: ^1.5.1

include: package:lint/analysis_options.yaml


Additionally, we also get a handy quick-fix after pressing the CTRL + . in VS Code.


Happy Coding :)

.....................................................................................................................................................................................................................................








No comments:

Post a Comment