Dart Operator: Precedence
In the operator has higher precedence than the operators in the rows that follow it. For example, the multiplicative operator %
has higher precedence than (and thus executes before) the equality operator ==
, which has higher precedence than the logical AND operator &&
. That precedence means that the following two lines of code execute the same way:
// Parentheses improve readability.
if ((n % i == 0) && (d % i == 0)) ...
// Harder to read, but equivalent.
if (n % i == 0 && d % i == 0) ...