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 theint 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 to (
-9,223,372,036,854,775,808to9,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 to (-9,007,199,254,740,991to9,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 with0x or 0X.
Parsing and Type Conversion
Theint class provides static methods for string-to-integer conversion, supporting optional radix (base) parameters ranging from 2 to 36.
Bitwise Operations
Becauseint 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
Theint 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





