> ## 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 Less Than

The `<` (less than) operator is a relational binary operator that evaluates whether the left operand is strictly smaller in value than the right operand, returning a `bool` (`true` or `false`).

In Dart, operators are implemented as instance methods. When the `<` operator is evaluated, Dart invokes the `operator <` method defined on the left operand's class, passing the right operand as the argument.

```dart theme={"dark"}
bool result = leftOperand < rightOperand;
```

## Built-in Type Behavior

For built-in numeric types (`num`, `int`, `double`), the `<` operator performs standard mathematical comparison. The Dart type system safely handles cross-type numeric comparisons (e.g., comparing an `int` to a `double`).

```dart theme={"dark"}
bool isLessNum = 5 < 10;        // true
bool isLessMixed = 5.0 < 5;     // false (strictly less than)
bool isLessNegative = -2 < -1;  // true
```

*Note: Dart's `String` class does not define relational operators. Attempting to use `<` on strings will result in a compile-time error. To compare strings lexicographically, developers must use the `compareTo` method.*

## Operator Overloading

Because `<` is an instance method, it can be defined or overridden in custom classes to establish specific comparison semantics for objects. The method must return a `bool` and typically accepts a parameter of the same class type.

```dart theme={"dark"}
class Temperature {
  final double celsius;

  const Temperature(this.celsius);

  // Overriding the < operator
  bool operator <(Temperature other) {
    return this.celsius < other.celsius;
  }
}

void main() {
  final t1 = Temperature(20.5);
  final t2 = Temperature(30.0);

  bool result = t1 < t2; // Evaluates to true
}
```

## Type Safety and Constraints

When defining the `<` operator, Dart's static analyzer enforces the parameter type declared in the method signature. If the right operand does not match the expected type, the compiler throws an error. For built-in types like `num`, the parameter is typed as `num`, preventing direct comparison with incompatible types like `String` or `bool`.

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