int class

An arbitrarily large integer.

An arbitrarily large integer.

Note: When compiling to JavaScript, integers are implemented as JavaScript numbers. When compiling to JavaScript, integers are therefore restricted to 53 significant bits because all JavaScript numbers are double-precision floating point values. The behavior of the operators and methods in the int class therefore sometimes differs between the Dart VM and Dart code compiled to JavaScript.

It is a compile-time error for a class to attempt to extend or implement int.

Extends:

Constructors

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

Static Methods

parse ( String source, {int radix, int onError(String source)} ) → int
Parse source as an integer literal and return its value.

Instance Properties

isEven bool
read-only
isOdd bool
read-only
bitLength int
read-only
sign int
read-only
isNegative bool Inherited
read-only
isInfinite bool Inherited
read-only
isNaN bool Inherited
read-only
hashCode int Inherited
read-only
isFinite bool Inherited
read-only

Instance Methods

modPow ( int exponent, int modulus ) → int
Returns this integer to the power of exponent modulo modulus.
modInverse ( int modulus ) → int
Returns the modular multiplicative inverse of this integer modulo modulus.
gcd ( int other ) → int
Returns the greatest common divisor of the absolute value of this integer and the absolute value of other.
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.
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 complem...
abs ( ) → int
Returns the absolute value of this integer.
round ( ) → int
Returns this.
floor ( ) → int
Returns this.
ceil ( ) → int
Returns this.
truncate ( ) → int
Returns this.
roundToDouble ( ) → double
Returns this.toDouble().
floorToDouble ( ) → double
Returns this.toDouble().
ceilToDouble ( ) → double
Returns this.toDouble().
truncateToDouble ( ) → double
Returns this.toDouble().
toString ( ) → String
Returns a String-representation of this integer.
toRadixString ( int radix ) → String
Converts this to a string representation in the given radix.
remainder Inherited ( num other ) → num
Returns the remainder of the truncating division of this by other.
toStringAsFixed Inherited ( int fractionDigits ) → String
Returns a decimal-point string-representation of this.
toStringAsPrecision Inherited ( int precision ) → String
Converts this to a double and returns a string representation with exactly precision significant digits.
compareTo Inherited ( num other ) → int
Compares this to other.
toDouble Inherited ( ) → double
Return this num as a double.
clamp Inherited ( num lowerLimit, num upperLimit ) → num
Returns this num clamped to be in the range lowerLimit-upperLimit.
toStringAsExponential Inherited ( [int fractionDigits] ) → String
Returns an exponential string-representation of this.
toInt Inherited ( ) → int
Truncates this num to an integer and returns the result as an int.

Operators

operator & ( int other ) → int
Bit-wise and operator.
operator | ( int other ) → int
Bit-wise or operator.
operator ^ ( int other ) → int
Bit-wise exclusive-or operator.
operator ~ ( ) → int
The bit-wise negate 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 unary- ( ) → int
Return the negative value of this integer.
operator ~/ Inherited ( num other ) → int
Truncating division operator.
operator / Inherited ( num other ) → double
Division operator.
operator < Inherited ( num other ) → bool
Relational less than operator.
operator >= Inherited ( num other ) → bool
Relational greater than or equal operator.
operator == Inherited ( Object other ) → bool
Test whether this value is numerically equal to other.
operator <= Inherited ( num other ) → bool
Relational less than or equal operator.
operator > Inherited ( num other ) → bool
Relational greater than operator.
operator * Inherited ( num other ) → num
Multiplication operator.
operator - Inherited ( num other ) → num
Subtraction operator.
operator % Inherited ( num other ) → num
Euclidean modulo operator.
operator + Inherited ( num other ) → num
Addition operator.