Why this matters
In Dart, void is a type that does not hold values. Assigning a value to a void variable is a logical error.
void VariablesAvoid assigning values to void variables as void is not a compatible type and doing so results in runtime errors.
In Dart, void is a type that does not hold values. Assigning a value to a void variable is a logical error.
Side-by-side examples engineers can pattern-match during review.
void x;
x = 3; // Non compliantdynamic x; // type of x not known
x = 3;From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.