-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The following lints are no-ops for non-Flutter code and adding them to the general lint set shouldn't cause any harm. They help developers craft clean UI code without unnecessary cruft while honoring the widget lifecycle contract and encourage good widget design practices.
avoid_unnecessary_containersavoid_web_libraries_in_flutterno_logic_in_create_statesized_box_for_whitespaceuse_full_hex_values_for_flutter_colorsuse_key_in_widget_constructors
The following lints also affect non-Flutter code, but I hope they can be added to the general lint set as well to have alignment between regular Dart and Flutter code (if not, they should go into a Flutter-specific lint set). Encouraging the use of const Widgets is beneficial for performance.
prefer_const_constructorsprefer_const_constructors_in_immutablesprefer_const_declarationsprefer_const_literals_to_create_immutablesavoid_type_to_string(currently broken: Rule avoid_type_to_string not working #58377) - avoids hard to debug differences between debug and release modeno_runtimeType_toString(subset ofavoid_type_to_string? If yes, not needed.) - discourages performance pitfallprefer_if_elements_to_conditional_expressions- cleaner code when generating children lists
The following lint is not appropriate for non-Flutter apps and should go into a Flutter-specific lint set:
avoid_print- avoids polluting production logs
@mit-mit and/or @munificent to figure out if the first two lists in this bug are OK to add to the general lint set.
/cc @Hixie @pq @devoncarew