# Dart Operator: Precedence

In Dart, operators have precedence, which determines the order in which they are evaluated when multiple operators are used in a single expression. Operators with higher precedence are evaluated before operators with lower precedence. If operators have the same precedence, they are evaluated from left to right. Here's a general overview of the operator precedence in Dart, from highest to lowest:

1. **Grouping**:
    
    * `()` - Parentheses are used to group expressions and force a specific evaluation order.
        
2. **Unary Operators**:
    
    * `!` (logical NOT)
        
    * `~` (bitwise NOT)
        
    * `+` (unary plus)
        
    * `-` (unary minus)
        
    * `++`, `--` (prefix increment and decrement)
        
3. **Multiplicative Operators**:
    
    * `*` (multiplication)
        
    * `/` (division)
        
    * `%` (modulo)
        
4. **Additive Operators**:
    
    * `+` (addition)
        
    * `-` (subtraction)
        
5. **Bitwise Shift Operators**:
    
    * `<<` (left shift)
        
    * `>>` (right shift)
        
6. **Bitwise AND Operator**:
    
    * `&`
        
7. **Bitwise XOR Operator**:
    
    * `^`
        
8. **Bitwise OR Operator**:
    
    * `|`
        
9. **Relational and Type Test Operators**:
    
    * `is`, `as`
        
    * `>`, `<`, `>=`, `<=`, `==`, `!=`
        
10. **Logical AND Operator**:
    
    * `&&`
        
11. **Logical OR Operator**:
    
    * `||`
        
12. **Conditional Operator**:
    
    * `? :`
        
13. **Assignment Operators**:
    
    * `=`, `+=`, `-=`, `*=`, `/=`, `%=`, `>>=`, `<<=`, `&=`, `^=`, `|=`
        
14. **Cascade Operator**:
    
    * `..`
        

The precedence rules in Dart follow the conventions of most programming languages, but it's important to keep them in mind when writing expressions to ensure that they are evaluated as intended. If in doubt, you can use parentheses to explicitly specify the order of evaluation.
