An integer number.

The default implementation of `int`

is 64-bit two's complement integers with operations that wrap to that range on overflow.

**Note:** When compiling to JavaScript, integers are restricted to values that can be represented exactly by double-precision floating point values. The available integer values include all integers between -2^53 and 2^53, and some integers with larger magnitude. That includes some integers larger than 2^63. The behavior of the operators and methods in the int class therefore sometimes differs between the Dart VM and Dart code compiled to JavaScript. For example, the bitwise operators truncate their operands to 32-bit integers when compiled to JavaScript.

Classes cannot extend, implement, or mix in `int`

.

- int.fromEnvironment(String name, { int defaultValue }) constfactory
- Returns the integer value of the given environment declaration
`name`

. [...]

- bitLength → int read-only
- Returns the minimum number of bits required to store this integer. [...]
- isEven → bool read-only
- Returns true if and only if this integer is even.
- isOdd → bool read-only
- Returns true if and only if this integer is odd.
- sign → int read-only, override
- Returns the sign of this integer. [...]
- hashCode → int read-only, inherited
- The hash code for this object. [...]
- isFinite → bool read-only, inherited
- True if the number is finite; otherwise, false. [...]
- isInfinite → bool read-only, inherited
- True if the number is positive infinity or negative infinity; otherwise, false.
- isNaN → bool read-only, inherited
- True if the number is the double Not-a-Number value; otherwise, false.
- isNegative → bool read-only, inherited
- True if the number is negative; otherwise, false. [...]
- runtimeType → Type read-only, inherited
- A representation of the runtime type of the object.

- abs(
) → int override - Returns the absolute value of this integer. [...]
- ceil(
) → int override - Returns
`this`

. - ceilToDouble(
) → double override - Returns
`this.toDouble()`

. - floor(
) → int override - Returns
`this`

. - floorToDouble(
) → double override - Returns
`this.toDouble()`

. - gcd(
int other) → int - Returns the greatest common divisor of this integer and
`other`

. [...] - modInverse(
int modulus) → int - Returns the modular multiplicative inverse of this integer modulo
`modulus`

. [...] - modPow(
int exponent, int modulus) → int - Returns this integer to the power of
`exponent`

modulo`modulus`

. [...] - round(
) → int override - Returns
`this`

. - roundToDouble(
) → double override - Returns
`this.toDouble()`

. - toRadixString(
int radix) → String - Converts this to a string representation in the given
`radix`

. [...] - toSigned(
int width) → int - Returns the least significant
`width`

bits of this integer, extending the highest retained bit to the sign. This is the same as truncating the value to fit in`width`

bits using an signed 2-s complement representation. The returned value has the same bit value in all positions higher than`width`

. [...] - toString(
) → String override - Returns a string representation of this integer. [...]
- toUnsigned(
int width) → int - Returns the least significant
`width`

bits of this integer as a non-negative number (i.e. unsigned representation). The returned value has zeros in all bit positions higher than`width`

. [...] - truncate(
) → int override - Returns
`this`

. - truncateToDouble(
) → double override - Returns
`this.toDouble()`

. - clamp(
num lowerLimit, num upperLimit) → num inherited - Returns this num clamped to be in the range
`lowerLimit`

-`upperLimit`

. [...] - compareTo(
num other) → int inherited - Compares this to
`other`

. [...] - noSuchMethod(
Invocation invocation) → dynamic inherited - Invoked when a non-existent method or property is accessed. [...]
- remainder(
num other) → num inherited - Returns the remainder of the truncating division of
`this`

by`other`

. [...] - toDouble(
) → double inherited - Return this num as a double. [...]
- toInt(
) → int inherited - Truncates this num to an integer and returns the result as an int.
- toStringAsExponential(
[int fractionDigits ]) → String inherited - Returns an exponential string-representation of
`this`

. [...] - toStringAsFixed(
int fractionDigits) → String inherited - Returns a decimal-point string-representation of
`this`

. [...] - toStringAsPrecision(
int precision) → String inherited - Converts
`this`

to a double and returns a string representation with exactly`precision`

significant digits. [...]

- operator &(
int other) → int - Bit-wise and operator. [...]
- operator <<(
int shiftAmount) → int - Shift the bits of this integer to the left by
`shiftAmount`

. [...] - operator >>(
int shiftAmount) → int - Shift the bits of this integer to the right by
`shiftAmount`

. [...] - operator ^(
int other) → int - Bit-wise exclusive-or operator. [...]
- operator unary-(
) → int override - Return the negative value of this integer. [...]
- operator |(
int other) → int - Bit-wise or operator. [...]
- operator ~(
) → int - The bit-wise negate operator. [...]
- operator %(
num other) → num inherited - Euclidean modulo operator. [...]
- operator *(
num other) → num inherited - Multiplication operator.
- operator +(
num other) → num inherited - Addition operator.
- operator -(
num other) → num inherited - Subtraction operator.
- operator /(
num other) → double inherited - Division operator.
- operator <(
num other) → bool inherited - Relational less than operator.
- operator <=(
num other) → bool inherited - Relational less than or equal operator.
- operator ==(
dynamic other) → bool inherited - The equality operator. [...]
- operator >(
num other) → bool inherited - Relational greater than operator.
- operator >=(
num other) → bool inherited - Relational greater than or equal operator.
- operator ~/(
num other) → int inherited - Truncating division operator. [...]

- parse(
String source, { int radix, int onError(String source) }) → int override - Parse
`source`

as a, possibly signed, integer literal and return its value. [...] - tryParse(
String source, { int radix }) → int override - Parse
`source`

as a, possibly signed, integer literal and return its value. [...]

© 2012 the Dart project authors

Licensed under the Creative Commons Attribution-ShareAlike License v4.0.

https://api.dart.dev/stable/2.5.0/dart-core/int-class.html