Skip to content

Files

Latest commit

 

History

History
29 lines (22 loc) · 683 Bytes

avoid_positional_boolean_parameters.md

File metadata and controls

29 lines (22 loc) · 683 Bytes

Pattern: Use of positional boolean parameter

Issue: -

Description

Positional boolean parameters are a bad practice because they are ambiguous. Using named boolean parameters is much more readable because it inherently describes what the boolean value represents.

Example of incorrect code:

Task(true);
Task(false);
ListBox(false, true, true);
Button(false);

Example of correct code:

Task.oneShot();
Task.repeating();
ListBox(scroll: true, showScrollbars: true);
Button(ButtonState.enabled);

Further Reading