Int32 class

An immutable 32-bit signed integer, in the range -2^31, 2^31 - 1. Arithmetic operations may overflow in order to maintain this range.

Implemented types

Constructors

Int32([int i = 0])
Constructs an Int32 from an int. Only the low 32 bits of the input are used.

Properties

bitLength int
Returns the minimum number of bits required to store this integer.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
isEven bool
Returns true if and only if this integer is even.
no setteroverride
isMaxValue bool
Returns true if and only if this integer is the maximum signed value that can be represented within its bit size.
no setteroverride
isMinValue bool
Returns true if and only if this integer is the minimum signed value that can be represented within its bit size.
no setteroverride
isNegative bool
Returns true if and only if this integer is less than zero.
no setteroverride
isOdd bool
Returns true if and only if this integer is odd.
no setteroverride
isZero bool
Returns true if and only if this integer is zero.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

abs() Int32
Returns the absolute value of this integer.
override
clamp(dynamic lowerLimit, dynamic upperLimit) Int32
Clamps this integer to be in the range lowerLimit - upperLimit.
override
compareTo(dynamic other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
numberOfLeadingZeros() int
Returns the number of high-order zeros in this integer's bit representation.
override
numberOfTrailingZeros() int
Returns the number of low-order zeros in this integer's bit representation.
override
remainder(dynamic other) Int32
Returns the remainder of the truncating division of this integer by other.
override
shiftRightUnsigned(int n) Int32
Unsigned right-shift operator.
override
toBytes() List<int?>
Returns a byte-sequence representation of this integer.
override
toDouble() double
Returns the double representation of this integer.
override
toHexString() String
Returns a string representing the value of this integer in hexadecimal notation; example: '0xd'.
override
toInt() int
Returns the int representation of this integer.
override
toInt32() Int32
Returns an Int32 representation of this integer.
override
toInt64() Int64
Returns an Int64 representation of this integer.
override
toRadixString(int radix) String
Returns a string representing the value of this integer in the given radix.
override
toSigned(int width) Int32
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.
override
toString() String
A string representation of this object.
override
toUnsigned(int width) Int32
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.
override

Operators

operator %(dynamic other) Int32
Euclidean modulo operator.
override
operator &(dynamic other) Int32
Bitwise and operator.
override
operator *(dynamic other) Int32
Multiplication operator.
override
operator +(dynamic other) Int32
Addition operator.
override
operator -(dynamic other) Int32
Subtraction operator.
override
operator <(dynamic other) bool
Relational less than operator.
override
operator <<(int n) Int32
Left bit-shift operator.
override
operator <=(dynamic other) bool
Relational less than or equal to operator.
override
operator ==(Object other) bool
Returns true if this Int32 has the same numeric value as the given object. The argument may be an int or an IntX.
override
operator >(dynamic other) bool
Relational greater than operator.
override
operator >=(dynamic other) bool
Relational greater than or equal to operator.
override
operator >>(int n) Int32
Right bit-shift operator.
override
operator ^(dynamic other) Int32
Bitwise xor operator.
override
operator unary-() Int32
Negate operator.
override
operator |(dynamic other) Int32
Bitwise or operator.
override
operator ~() Int32
Bitwise negate operator.
override
operator ~/(dynamic other) Int32
Truncating division operator.
override

Static Methods

parseHex(String s) Int32
Parses a hexadecimal String and returns an Int32.
parseInt(String s) Int32
Parses a decimal String and returns an Int32.
parseRadix(String s, int radix) Int32
Parses a String in a given radix between 2 and 16 and returns an Int32.

Constants

MAX_VALUE → const Int32
The maximum positive value attainable by an Int32, namely 2147483647.
MIN_VALUE → const Int32
The minimum positive value attainable by an Int32, namely -2147483648.
ONE → const Int32
An Int32 constant equal to 1.
TWO → const Int32
An Int32 constant equal to 2.
ZERO → const Int32
An Int32 constant equal to 0.