Integer class

Inheritance

Constructors

Integer(int value)
Integer.parse(String value)
factory

Properties

hashCode int
Returns a hash code for a numerical value.
no setteroverride
isInfinite bool
True if the number is infinite; otherwise, false.
no setteroverride
isNaN bool
True if the number is not a number; otherwise, false.
no setteroverride
isNegative bool
True if the number is negative; otherwise, false.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sign Integer
Returns minus one, zero or plus one depending on the sign and numerical value of the number.
no setteroverride
value int
getter/setter pair

Methods

abs() Number
Returns the absolute value of this num.
override
ceil() Integer
Returns the least integer no smaller than this.
override
compareTo(Number other) int
Compares this to other.
override
floor() Integer
Returns the greatest integer no greater than this.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remainder(Number other) Number
Returns the remainder of the truncating division of this by other.
override
round() Integer
Returns the integer closest to this.
override
roundWithPrecision(int precision, [RoundingMode mode = RoundingMode.nearestEven]) Number
Returns number rounded according to precision and RoundingMode.
override
toInt() int
Truncates this Number to an integer and returns the result as an int. */
override
toInteger() Integer
Truncates this Number to an integer and returns the result as an Integer.
override
toString() String
Returns the shortest string that correctly represent the input number.
override
toStringAsExponential([int? fractionDigits]) String
Returns an exponential string-representation of this.
override
toStringAsFixed(int fractionDigits) String
Returns a decimal-point string-representation of this. Converts this to a Decimal before computing the string representation. If the absolute value of this is greater or equal to 10^21 then this methods returns an exponential representation computed by this.toStringAsExponential(). Otherwise the result is the closest string representation with exactly fractionDigits digits after the decimal point. If fractionDigits equals 0 then the decimal point is omitted.
override
toStringAsPrecision(int precision) String
Converts this to a decimal and returns a string representation with exactly precision significant digits.
override
truncate() Integer
Returns the integer obtained by discarding any fractional digits from this.
override

Operators

operator %(Number other) Number
Euclidean modulo operator.
override
operator *(Number other) Number
Multiplication operator.
override
operator +(Number other) Number
Addition operator.
override
operator -(Number other) Number
Subtraction operator.
override
operator /(Number other) Decimal
Division operator.
override
operator <(Number other) bool
Relational less than operator.
override
operator <=(Number other) bool
Relational less than or equal operator.
override
operator ==(Object other) bool
Test whether this value is numerically equal to other.
override
operator >(Number other) bool
Relational greater than operator.
override
operator >=(Number other) bool
Relational greater than or equal operator.
override
operator unary-() Number
Negate operator.
override
operator ~/(Number other) Integer
Truncating division operator.
override