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

The `=` operator in Dart is the fundamental assignment operator. It evaluates the expression on its right-hand side and binds the resulting object reference to the variable specified on its left-hand side.

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

## Technical Characteristics

**Associativity and Evaluation Order**
The `=` operator has right-to-left associativity. The Dart compiler evaluates the right-hand expression completely before attempting to bind it to the left-hand identifier. Because the assignment operation itself returns the assigned value, right-to-left associativity enables chained assignments.

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

// Evaluates right-to-left: c = 5, then b = 5, then a = 5.
a = b = c = 5; 
```

**Reference Semantics**
Because everything in Dart is an object (including numbers, functions, and `null`), variables do not store actual data payloads; they store memory references to objects. The `=` operator mutates the variable's reference to point to a new object in memory. It does not perform a deep copy or duplicate the underlying object data.

```dart theme={"dark"}
List<int> listA = [1, 2, 3];
List<int> listB;

// listB now holds a reference to the exact same object in memory as listA.
listB = listA; 
```

**Static Type Checking**
Dart is a statically typed language. During compilation, the `=` operator enforces type safety by verifying that the static type of the right-hand expression is assignable to (i.e., is a subtype of) the declared type of the left-hand variable. If the types are incompatible, the compiler throws an error.

```dart theme={"dark"}
num myNumber;
int myInteger = 10;

// Valid: 'int' is a subtype of 'num'
myNumber = myInteger; 

// Invalid: Compile-time error. 'double' is not a subtype of 'int'
// myInteger = 10.5; 
```

**Sound Null Safety Enforcement**
Under Dart's sound null safety system, the `=` operator strictly enforces nullability constraints. It will reject the assignment of a `null` literal or a nullable variable to a non-nullable variable at compile time.

```dart theme={"dark"}
String nonNullableString;
String? nullableString = null;

// Invalid: Compile-time error. Cannot assign a nullable type to a non-nullable type.
// nonNullableString = nullableString; 
```

**Constant Initialization**
When used in conjunction with the `const` or `final` keywords during variable declaration, the `=` operator acts as an initializer rather than a standard assignment. For `const`, the right-hand expression must be a compile-time constant. For `final` and `const` variables, the `=` operator can only be applied once; subsequent reassignment attempts 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>
