> ## 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 Show Combinator

The `show` combinator is a directive modifier in Dart used alongside `import` or `export` statements to act as an explicit inclusion whitelist. It restricts the visibility of an external library's API by selectively bringing only the specified top-level declarations (classes, functions, variables, or typedefs) into the current library's namespace, leaving all unlisted declarations inaccessible.

```dart theme={"dark"}
import 'package:library_name/library_name.dart' show DeclarationOne, declarationTwo;
export 'package:library_name/library_name.dart' show DeclarationOne;
```

## Mechanics and Syntax Rules

* **Comma-Separated Identifiers:** Multiple declarations must be separated by commas. The identifiers must exactly match the exported names from the target library.
* **Namespace Isolation:** Declarations omitted from the `show` list are not bound in the importing library's scope. Attempting to reference an unlisted declaration results in a static analysis error (`undefined_identifier`).
* **Chaining with Prefixes:** The `show` combinator can be chained with the `as` directive. The filtering occurs before the prefix is applied to the namespace.
* **Export Re-routing:** When used with `export`, the `show` combinator restricts which parts of an external library are re-exported as part of the current library's public API.

## Code Illustration

Given an external library `arithmetic.dart`:

```dart theme={"dark"}
// arithmetic.dart
int add(int a, int b) => a + b;
int subtract(int a, int b) => a - b;
int multiply(int a, int b) => a * b;
```

Applying the `show` combinator in the importing library:

```dart theme={"dark"}
// main.dart
import 'arithmetic.dart' show add, subtract;

void main() {
  print(add(5, 3));      // Valid: explicitly shown
  print(subtract(5, 3)); // Valid: explicitly shown
  
  // print(multiply(5, 3)); 
  // Error: The function 'multiply' isn't defined.
}
```

## Combinator Chaining

When combining `show` with a namespace prefix (`as`), the syntax requires the prefix declaration to precede the combinator:

```dart theme={"dark"}
import 'arithmetic.dart' as math show add;

void main() {
  print(math.add(5, 3)); // Valid
}
```

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