> ## 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 Export Directive

The `export` directive in Dart is a library-level declaration used to re-expose the public API of another library. By utilizing this directive, a library can forward the public members (classes, functions, variables, typedefs) of a specified Uniform Resource Identifier (URI) to any external library that imports it, effectively merging namespaces.

## Syntax

The fundamental syntax requires the `export` keyword followed by a string literal representing the URI of the target library.

```dart theme={"dark"}
export 'path/to/library.dart';
export 'package:module/library.dart';
```

## Combinators

To control namespace pollution and resolve potential naming collisions, the `export` directive supports combinators. These modifiers restrict exactly which members are re-exposed to the consuming library.

* **`show` (Whitelist):** Restricts the export to only the explicitly declared identifiers.
* **`hide` (Blacklist):** Exports all public members of the target library except the explicitly declared identifiers.

```dart theme={"dark"}
// Exports only the 'StringUtil' and 'MathUtil' classes
export 'package:utils/utils.dart' show StringUtil, MathUtil;

// Exports all public members except 'InternalConfig'
export 'package:core/core.dart' hide InternalConfig;
```

## Conditional Exports

Dart supports conditional exports to evaluate configuration environment constants at compile-time and dynamically determine which URI to export. The compiler evaluates the `if` conditions sequentially and exports the URI of the first condition that evaluates to true. If no conditions are met, it resolves the default URI declared before the conditions.

```dart theme={"dark"}
export 'src/stub_implementation.dart'
    if (dart.library.io) 'src/io_implementation.dart'
    if (dart.library.html) 'src/web_implementation.dart';
```

## Scope and Visibility Rules

1. **Public Members Only:** The `export` directive strictly applies to public members. Any identifier prefixed with an underscore (`_`), which denotes library privacy in Dart, is inherently excluded from the export process.
2. **Local Scope Isolation:** Declaring an `export` does *not* introduce the target library's members into the lexical scope of the exporting file. If the exporting file needs to reference those members internally, it must declare a separate `import` directive for the same URI.

```dart theme={"dark"}
// Re-exposes 'NetworkClient' to external consumers
export 'src/network_client.dart';

// Required to instantiate or reference 'NetworkClient' within this specific file
import 'src/network_client.dart'; 
```

3. **Transitive Exporting:** Exports are transitive. If Library A exports Library B, and Library B exports Library C, any library importing Library A will have access to the public APIs of both Library B and Library C.
4. **Name Collisions:** Dart strictly enforces export namespaces. If a library exports multiple URIs that contain identical public identifiers, Dart will throw an `ambiguous_export` compile-time error directly in the file containing the conflicting `export` directives. This error occurs immediately upon compilation, regardless of whether a consuming library attempts to use the identifier. This ambiguity must be resolved at the export level using `show` or `hide` combinators to ensure a clean, unified namespace.

```dart theme={"dark"}
// Assuming both libraries contain a 'Logger' class, 
// the 'hide' combinator prevents an ambiguous_export compile-time error:
export 'src/file_logger.dart' hide Logger;
export 'src/console_logger.dart'; 
```

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