solid_lints icon indicating copy to clipboard operation
solid_lints copied to clipboard

Lint: use shorter name for local variable

Open danylo-safonov-solid opened this issue 1 year ago • 0 comments

If variable is used within x lines (e.g. make it 10, or make it configurable) prefer a shorter name, because it can probably deduced from context

final selectedNames = users.map((u) => u.name).where((n) => n.isSelected).toList();
final selectedNames = users.map((user) => user.name).where((name) => name.isSelected).toList();

first example is easier to read

danylo-safonov-solid avatar Mar 27 '24 22:03 danylo-safonov-solid