> ## 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 Overridden Getter

An overridden getter in Dart is a property accessor in a subclass that redefines the retrieval logic of a property inherited from its superclass. Because Dart adheres to the Uniform Access Principle by implicitly generating getters for all instance variables, a subclass can override both explicitly defined superclass getters and standard instance fields.

To override a getter, the subclass uses the `@override` annotation followed by the `get` keyword, ensuring the signature conforms to the parent's contract.

## Overriding an Explicit Getter

When a superclass defines a property using the `get` keyword, the subclass can replace its implementation.

```dart theme={"dark"}
class BaseClass {
  String get identifier => 'Base-001';
}

class SubClass extends BaseClass {
  @override
  String get identifier => 'Sub-001';
}
```

## Overriding an Instance Field with a Getter

Because a standard field in Dart implicitly exposes a getter, a subclass can override a stored variable from the superclass and replace it with a computed property.

```dart theme={"dark"}
class BaseClass {
  final double threshold = 10.5;
}

class SubClass extends BaseClass {
  @override
  double get threshold => super.threshold * 2.0;
}
```

## Technical Constraints and Rules

* **Covariant Return Types:** The return type of the overridden getter must be the same as, or a subtype of, the return type of the superclass getter. You cannot widen the return type.

```dart theme={"dark"}
class BaseClass {
  num get value => 10;
}

class SubClass extends BaseClass {
  @override
  int get value => 20; // Valid: int is a subtype of num
}
```

* **Super Invocation:** The subclass getter can access the superclass implementation or field value using the `super` keyword (`super.propertyName`).
* **Setter Inheritance:** If the superclass defines a mutable (non-final) field, it implicitly creates both a getter and a setter. Overriding *only* the getter in the subclass modifies the read behavior, but the implicit setter inherited from the superclass remains intact and functional unless explicitly overridden as well.
* **Annotation Requirement:** While the `@override` annotation is technically optional in Dart, it is strictly enforced by the Dart analyzer in standard linting rules to prevent silent failures if the superclass contract changes.

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