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
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
trueif and only if this integer is even.no setteroverride - isMaxValue → bool
-
Returns
trueif and only if this integer is the maximum signed value that can be represented within its bit size.no setteroverride - isMinValue → bool
-
Returns
trueif and only if this integer is the minimum signed value that can be represented within its bit size.no setteroverride - isNegative → bool
-
Returns
trueif and only if this integer is less than zero.no setteroverride - isOdd → bool
-
Returns
trueif and only if this integer is odd.no setteroverride - isZero → bool
-
Returns
trueif 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(
Object lowerLimit, Object upperLimit) → Int32 -
Clamps this integer to be in the range
lowerLimit-upperLimit.override -
compareTo(
Object 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(
Object 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.
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
widthbits of this integer, extending the highest retained bit to the sign. This is the same as truncating the value to fit inwidthbits using an signed 2-s complement representation. The returned value has the same bit value in all positions higher thanwidth.override -
toString(
) → String -
A string representation of this object.
override
-
toUnsigned(
int width) → Int32 -
Returns the least significant
widthbits of this integer as a non-negative number (i.e. unsigned representation). The returned value has zeros in all bit positions higher thanwidth.override
Operators
-
operator %(
Object other) → Int32 -
Euclidean modulo operator.
override
-
operator &(
Object other) → Int32 -
Bitwise and operator.
override
-
operator *(
Object other) → IntX -
Multiplication operator.
override
-
operator +(
Object other) → IntX -
Addition operator.
override
-
operator -(
Object other) → IntX -
Subtraction operator.
override
-
operator <(
Object other) → bool -
Relational less than operator.
override
-
operator <<(
int n) → Int32 -
Left bit-shift operator.
override
-
operator <=(
Object other) → bool -
Relational less than or equal to operator.
override
-
operator ==(
Object other) → bool -
Returns
trueif this Int32 has the same numeric value as the given object. The argument may be an int or an IntX.override -
operator >(
Object other) → bool -
Relational greater than operator.
override
-
operator >=(
Object other) → bool -
Relational greater than or equal to operator.
override
-
operator >>(
int n) → Int32 -
Right bit-shift operator.
override
-
operator ^(
Object other) → Int32 -
Bitwise xor operator.
override
-
operator unary-(
) → Int32 -
Subtraction operator.
override
-
operator |(
Object other) → Int32 -
Bitwise or operator.
override
-
operator ~(
) → Int32 -
Bitwise negate operator.
override
-
operator ~/(
Object other) → Int32 -
Truncating division operator.
override
Static Methods
-
parseHex(
String source) → Int32 -
Parses
sourceas a hexadecimal numeral. -
parseInt(
String source) → Int32 -
Parses
sourceas a decimal numeral. -
parseRadix(
String source, int radix) → Int32 -
Parses
sourcein a givenradixbetween 2 and 36. -
tryParseHex(
String source) → Int32? -
Parses
sourceas a hexadecimal numeral. -
tryParseInt(
String source) → Int32? -
Parses
sourceas a decimal numeral. -
tryParseRadix(
String source, int radix) → Int32? -
Parses
sourcein a givenradixbetween 2 and 36.
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.