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

The `int` type in Dart is an immutable, non-fractional numeric data type that extends the abstract `num` class. It represents whole numbers and implements `Comparable<num>`, supporting standard arithmetic, relational, and bitwise operations.

## Memory Representation and Platform Bounds

Dart's underlying architecture dictates the memory footprint and limits of the `int` type based on the compilation target:

* **Dart Native (VM, JIT, and AOT):** Represented as a 64-bit two's complement integer. The representable range is $-2^{63}$ to $2^{63} - 1$ (`-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807`).
* **Dart Web (dart2js and dartdevc):** Represented as a JavaScript `Number`, which is an IEEE 754 double-precision floating-point value. The safe integer range without precision loss is restricted to $-2^{53} + 1$ to $2^{53} - 1$ (`-9,007,199,254,740,991` to `9,007,199,254,740,991`). Exceeding these bounds on the web results in silent precision loss rather than a standard integer overflow.

## Literal Syntax

Integer literals can be declared using standard decimal notation or hexadecimal notation prefixed with `0x` or `0X`.

```dart theme={"dark"}
int decimalValue = 42;
int negativeValue = -1024;
int hexValue = 0xDEADBEEF;
```

## Parsing and Type Conversion

The `int` class provides static methods for string-to-integer conversion, supporting optional radix (base) parameters ranging from 2 to 36.

```dart theme={"dark"}
// Throws FormatException if parsing fails
int parsed = int.parse('42');

// Returns null if parsing fails (safe parsing)
int? safelyParsed = int.tryParse('42px'); 

// Parsing with a specific radix
int hexParsed = int.parse('FF', radix: 16); // 255
int binaryParsed = int.parse('1010', radix: 2); // 10
```

## Bitwise Operations

Because `int` represents discrete bits, it fully supports bitwise manipulation. On the web, bitwise operations truncate the operands to 32-bit integers before evaluating.

```dart theme={"dark"}
int a = 5;  // 0101 in binary
int b = 3;  // 0011 in binary

int bitwiseAnd = a & b;      // 0001 (1)
int bitwiseOr = a | b;       // 0111 (7)
int bitwiseXor = a ^ b;      // 0110 (6)
int bitwiseNot = ~a;         // Bitwise NOT (one's complement), yields -6
int shiftLeft = a << 1;      // 1010 (10)
int shiftRight = a >> 1;     // 0010 (2)
int unsignedShift = a >>> 1; // Logical right shift (fills with 0)
```

## Core Properties and Methods

The `int` class exposes several built-in getters and methods for mathematical evaluation and base conversion.

```dart theme={"dark"}
int value = -42;

// Parity evaluation
bool isEven = value.isEven; // true
bool isOdd = value.isOdd;   // false

// Mathematical properties
int sign = value.sign;      // -1 (Returns -1, 0, or 1)
int absolute = value.abs(); // 42

// Base conversion
String binaryString = absolute.toRadixString(2); // "101010"
String hexString = absolute.toRadixString(16);   // "2a"

// Division yielding an integer (truncating division)
int quotient = 10 ~/ 3; // 3
```

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