> ## 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 Addition Assignment

The `+=` (addition assignment) operator is a compound assignment operator that evaluates the right-hand expression, adds its value to the current value of the left-hand variable, and assigns the computed result back to the left-hand variable.

## Syntax

```dart theme={"dark"}
variable += expression;
```

This operation is syntactic sugar for the following standard assignment:

```dart theme={"dark"}
variable = variable + expression;
```

## Type-Specific Behavior

The underlying operation executed by `+=` is dictated by the static type of the left operand and its specific implementation of the `+` operator:

* **Numeric Types (`int`, `double`, `num`):** Performs standard arithmetic addition.
* **Strings (`String`):** Performs string concatenation.
* **Custom Classes:** Invokes the overridden `operator +` method defined on the left operand's class.

## Technical Characteristics

* **Single Evaluation:** The left operand is evaluated exactly once. In a complex expression such as `collection[computeIndex()] += value`, the `computeIndex()` function is executed only one time. This differs from the expanded form `collection[computeIndex()] = collection[computeIndex()] + value`, which would evaluate the index twice.
* **Type Compatibility:** The return type of the underlying `+` operation must be assignable to the static type of the left operand. For example, if `a` is an `int` and `b` is a `double`, the expression `a += b` will throw a compile-time error. The operation `a + b` yields a `double`, which cannot be assigned back to the `int` variable `a` without an explicit cast.
* **Mutability Requirement:** The left operand must be a mutable reference. It cannot be a variable declared with the `final` or `const` modifiers.
* **Null Safety:** Neither the left nor the right operand can be `null` unless the left operand's class explicitly overrides `operator +` to accept nullable types (which is highly non-standard in Dart). Attempting `+=` on a nullable numeric or string type without prior null-checking will result in a compile-time error.

<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>
