> ## 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 Logical-And Pattern

The logical-and pattern (`&&`) is a composite pattern in Dart that matches a value if and only if both of its subpatterns successfully match the same value. It allows developers to apply multiple constraints, type checks, or destructuring operations to a single expression simultaneously.

## Syntax

The pattern is constructed using the `&&` operator between two subpatterns:

```dart theme={"dark"}
leftSubpattern && rightSubpattern
```

## Evaluation Mechanics

1. **Shared Target:** Both `leftSubpattern` and `rightSubpattern` evaluate against the exact same matched value.
2. **Left-to-Right Execution:** The pattern evaluates the `leftSubpattern` first.
3. **Short-Circuiting:** If the `leftSubpattern` fails to match, the entire logical-and pattern fails immediately. The `rightSubpattern` is never evaluated.
4. **Success Condition:** The pattern as a whole succeeds only if the left subpattern succeeds *and* the right subpattern succeeds.

## Variable Binding Rules

When using variable patterns within a logical-and pattern, the following strict scoping and binding rules apply:

* **Union of Bindings:** The variables bound by the logical-and pattern are the union of the variables bound by both the left and right subpatterns.
* **No Shadowing/Collisions:** It is a compile-time error if both subpatterns attempt to bind a variable with the exact same name.
* **Scope Availability:** Variables bound in the left subpattern are not available for use within the right subpattern's evaluation logic, but all bound variables from both sides are exposed to the resulting case body if the entire pattern matches.

## Structural Examples

**Combining a Type Test with a Relational Pattern**
The left subpattern binds the value to a typed variable, while the right subpattern applies a relational constraint to the same value.

```dart theme={"dark"}
switch (value) {
  case int x && >= 10:
    // Matches if 'value' is an integer AND is greater than or equal to 10.
    // 'x' is bound to the matched integer.
    break;
}
```

**Multiple Destructuring on a Single Value**
The logical-and pattern can extract different properties from the same object or record simultaneously by applying multiple object or record patterns.

```dart theme={"dark"}
switch (pointRecord) {
  case (int x, _) && (_, int y):
    // Matches if the record has an integer in the first position AND an integer in the second.
    // Binds 'x' from the left subpattern and 'y' from the right subpattern.
    break;
}
```

**Chaining Multiple Logical-And Patterns**
The `&&` operator is left-associative and can be chained to enforce more than two constraints or extractions on the same value. When extracting properties from a class instance within a chain, an object pattern with an explicit type name must be used.

```dart theme={"dark"}
if (value case List<int> list && List<int>(length: var len) && [_, var second, ...]) {
  // 1. Type test and variable binding: Checks if value is List<int> and binds to 'list'
  // 2. Object pattern property extraction: Matches List<int>, extracts the 'length' getter, and binds to 'len'
  // 3. List pattern destructuring: Ensures at least two elements and binds the second to 'second'
}
```

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