Skip to main content
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 263-2^{63} to 26312^{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 253+1-2^{53} + 1 to 25312^{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.

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.

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.

Core Properties and Methods

The int class exposes several built-in getters and methods for mathematical evaluation and base conversion.
Tired of Poor Dart Skills? Fix That With Deep Grasping!Learn More