> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dart Postfix Increment

The `++` operator is a unary assignment operator that increments an assignable expression by invoking its `+` operator with the exact integer argument `1`. Because Dart variables and properties hold references and numeric types are immutable, this operator does not mutate the underlying object in place; instead, it reassigns the expression to reference the newly created object resulting from the addition.

The operator requires the operand to be an assignable expression. This includes non-`final` local variables, property accesses (e.g., `object.property`), and index expressions (e.g., `list[index]`). Because Dart supports operator overloading, `++` is not restricted to numeric types. It can be applied to any custom class that defines `operator +`, provided the return type of that method is assignable back to the expression's declared type.

Depending on its placement relative to the operand, the operator exhibits two distinct evaluation semantics: prefix and postfix.

**Prefix Increment (`++expr`)**
In the prefix form, the expression evaluates the addition, performs the reassignment, and then yields the newly assigned value.

```dart theme={"dark"}
int a = 10;
int b = ++a; 

// Evaluation sequence:
// 1. The expression '++a' evaluates 'a + 1' (11).
// 2. 'a' is reassigned to reference the new object (11).
// 3. The expression '++a' yields 11.
// 4. 'b' is assigned the yielded value (11).
// Final state: a = 11, b = 11
```

**Postfix Increment (`expr++`)**
In the postfix form, the expression yields the original value of the operand, but the reassignment occurs *during* the evaluation of the `expr++` expression itself. The increment side-effect completes entirely before the yielded value is used in any surrounding context, such as an outer assignment.

```dart theme={"dark"}
int x = 10;
int y = x++; 

// Evaluation sequence:
// 1. The expression 'x++' caches the current value of 'x' (10).
// 2. 'x' is reassigned to reference the result of 'x + 1' (11).
// 3. The expression 'x++' completes and yields the cached value (10).
// 4. 'y' is assigned the yielded value (10).
// Final state: x = 11, y = 10
```

**Technical Constraints and Behavior**

* **Single Evaluation:** While conceptually similar to `expr = expr + 1`, the `++` operator guarantees that the receiver or index of the assignable expression is evaluated exactly *once*. For example, in the index expression `list[getIndex()]++`, the function `getIndex()` is called only once. The expanded form `list[getIndex()] = list[getIndex()] + 1` would evaluate the index twice, potentially causing unintended side effects.
* **Assignable Expression Requirement:** The operator must be applied to a valid assignable expression. Applying it to a literal value (e.g., `5++`) or an unassignable expression (such as a `final` variable or a getter without a corresponding setter) results in a compile-time error.
* **Type Resolution:** The operation does not inherently preserve the operand's type. The resulting type depends entirely on the return type defined by the object's `operator +` method. The Dart analyzer enforces that this return type must be assignable to the expression's declared type to guarantee type safety during the implicit reassignment.
* **Integer Argument:** According to the Dart language specification, the operator always invokes the `+` operator with the integer `1`, regardless of the operand's type (e.g., if applied to a `double`, it evaluates as `expr + 1`, not `expr + 1.0`).

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Dart Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
