TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
%= operator is a compound assignment operator in Dart, formally known as the modulo assignment operator. It performs a modulo operation using the left-hand and right-hand operands, and assigns the resulting value back to the left-hand operand.
target is evaluated only once:
- Evaluation Order: Dart evaluates the left-hand expression first to determine the exact assignment target (such as resolving an object reference, property getter, or array index). It then evaluates the right-hand expression, performs the modulo operation against the target’s current value, and finally executes the assignment.
- Type Constraints: The left-hand operand must be a mutable variable or a settable property (cannot be
constorfinalafter initialization). While natively supported by Dart’s built-in numeric types (int,double,num), the%=operator is not restricted to numbers; it can be applied to any custom class that explicitly overridesoperator %. - Euclidean Modulo (Numeric Types): For Dart’s core numeric types, the underlying
%operator implements Euclidean division. Consequently, the assigned remainder will always be a non-negative value, regardless of whether the left-hand or right-hand operand is negative. - Division by Zero (Numeric Types): If the right-hand operand evaluates to
0, the operation yieldsNaN(Not-a-Number) if the left-hand variable is adouble, or throws anUnsupportedErrorif the variable is anint.
Master Dart with Deep Grasping Methodology!Learn More





