> ## 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 Type Alias

A type alias (declared using the `typedef` keyword) is a compile-time construct that provides an alternative identifier for an existing type. It does not introduce a new, distinct type into the Dart type system; instead, it acts as a symbolic reference that the compiler strictly resolves to the underlying type during static analysis.

## Syntax

The modern Dart syntax (introduced in Dart 2.13) allows aliasing of any type, utilizing an assignment-style declaration.

```dart theme={"dark"}
typedef AliasName<TypeParameters> = ExistingType<TypeParameters>;
```

## Technical Characteristics

* **Type Equivalence:** Because a type alias is structurally identical to its underlying type, they are completely interchangeable. Type checks (`is`) and runtime type evaluations (`.runtimeType`) will always evaluate to the original, underlying type.
* **Generic Parameterization:** Type aliases can declare type parameters, allowing partial or complete application of generics to the underlying type.
* **Compile-Time Resolution:** Aliases are stripped away during compilation. The Dart Virtual Machine (VM) and compiled JavaScript/machine code only possess knowledge of the underlying types.

## Structural Examples

**1. Aliasing Generic Types**
You can alias complex generic structures. The alias can bind specific type arguments, pass them through, or partially apply them.

```dart theme={"dark"}
// Fully bound type alias
typedef StringMap = Map<String, String>;

// Partially bound generic type alias
typedef JsonMap<T> = Map<String, T>;

// Pass-through generic type alias
typedef Matrix<T> = List<List<T>>;
```

**2. Aliasing Function Types**
While Dart historically used a specific, C-style syntax for function aliases, modern Dart uses the standard assignment syntax for function signatures.

```dart theme={"dark"}
// Modern function type alias
typedef StringTransformer = String Function(String input);

// Legacy function type alias (supported but discouraged)
typedef String LegacyTransformer(String input);
```

**3. Aliasing Primitive Types**
Aliases can be applied directly to primitive or scalar types.

```dart theme={"dark"}
typedef Identifier = int;
```

## Type Identity Demonstration

The following code illustrates that the Dart analyzer and runtime treat the alias and the base type as the exact same entity:

```dart theme={"dark"}
typedef Score = double;

void main() {
  Score myScore = 95.5;
  double standardDouble = 95.5;

  // Evaluates to true. The runtime type is 'double', not 'Score'.
  print(myScore.runtimeType == double); 
  
  // Evaluates to true. They are structurally identical.
  print(myScore.runtimeType == standardDouble.runtimeType); 
  
  // Valid assignment: The compiler sees 'Score' as 'double'.
  standardDouble = myScore; 
}
```

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