Integer class

Wraps Dart's core int type, so that it can share a common base type with other Numbers.

Inheritance
Implementers

Constructors

Integer(int _value)
Constructs a instance.
Integer.constant(int _value)
Constructs a constant Integer.
const
Integer.fromMap(Map<String, int>? m)
Construct an Integer from a Map: { 'i': integer value }
factory
Integer.parse(String str, {int radix = 10})
Constructs a instance.

Properties

hashCode int
Returns the same hash as the int with the same value.
no setteroverride
isFinite bool
Whether this Number represents a finite value.
no setterinherited
isInfinite bool
Whether this Number represents infinity.
no setteroverride
isInteger bool
True if the Number represents an integer value. Note that the Number does not have to be of type Integer for this to be true.
no setteroverride
isNaN bool
Whether this Number represents a value .
no setteroverride
isNegative bool
Whether this number is less than zero.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sign num
Returns minus one, zero or plus one depending on the sign and numerical value of the number. Returns minus one if the number is less than zero, plus one if the number is greater than zero, and zero if the number is equal to zero. Returns NaN if the number is NaN. Returns an int if this Number's value is an integer, a double otherwise.
no setterinherited
value int
All Real subclasses must be able to provide their value as a dart:core num.
no setteroverride

Methods

abs() Integer
The absolute value, returned as an Integer. Returns itself if its value is greater than or equal to zero.
override
bitwiseXor(dynamic n) Integer
A substitute method to perform bitwise XOR operation on integers. The caret operator is overridden to provide a power operator for all Numbers.
ceil() Number
Returns the least Number having integer components no smaller than this Number.
override
clamp(dynamic lowerLimit, dynamic upperLimit) Number
Returns this num clamped to be in the range lowerLimit-upperLimit. The comparison is done using compareTo and therefore takes -0.0 into account. This also implies that double.NAN is treated as the maximal double value. lowerLimit and upperLimit are expected to be num or `Number' objects.
override
compareTo(dynamic n2) int
Compares this Number to another Number by comparing values. n2 is expected to be a num or Number. If it is not it will be considered to have a value of 0.
inherited
floor() Number
Returns the greatest Number with an integer value no greater than this Number. If this is not finite (NaN or infinity), throws an UnsupportedError.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reciprocal() Number
Returns the Number that is the reciprocal of this Number. This Number is unaffected.
inherited
remainder(dynamic divisor) Number
Returns the remainder of the truncating division of this Number by divisor. The result r of this operation satisfies: this == (this ~/ other) * other + r. As a consequence the remainder r has the same sign as the operator /(divisor).
inherited
round() Number
Returns the integer Number closest to this Number. Rounds away from zero when there is no closest integer: (3.5).round() == 4 and (-3.5).round() == -4. If this is not finite (NaN or infinity), throws an UnsupportedError.
inherited
toDouble() double
Converts this Number to a dart:core double.
override
toInt() int
Converts this Number to a dart:core int.
override
toJson() Map<String, int>
Support dart:json stringify.
override
toString() String
A string representation of this object.
inherited
truncate() Number
Returns a truncated value.
override

Operators

operator %(dynamic divisor) Number
The modulo operator.
override
operator &(dynamic n) Number
Bitwise AND.
operator *(dynamic multiplicand) Number
Returns the product of this Number and the multiplicand (a Number or num). This Number is unaffected.
override
operator +(dynamic addend) Number
Addition operator.
override
operator -(dynamic subtrahend) Number
Returns the difference of this Number and the subtrahend (a Number or num). This Number is unaffected.
override
operator /(dynamic divisor) Number
Returns the quotient of this Number divided by the divisor (a Number or num). This Number is unaffected.
inherited
operator <(dynamic obj) bool
Returns whether the value of this Number is less than the value of obj (a Number or num).
inherited
operator <<(dynamic n) Number
Shift the bits of this integer to the left by n.
operator <=(dynamic obj) bool
Returns whether the value of this Number is less than or equal to the value of obj (a Number or num).
inherited
operator ==(dynamic obj) bool
Tests whether this Integer is equal to another Object obj. Only num and Number objects having the same real integer value (and no imaginary component) are considered equal.
override
operator >(dynamic obj) bool
Returns whether the value of this Number is greater than the value of obj (a Number or num).
inherited
operator >=(dynamic obj) bool
Returns whether the value of this Number is greater than or equal to the value of obj (a Number or num).
inherited
operator >>(dynamic n) Number
Shift the bits of this integer to the right by n.
operator ^(dynamic exponent) Number
The power operator (note: NOT bitwise XOR).
inherited
operator unary-() Integer
Negation operator.
override
operator |(dynamic n) Number
Bitwise OR.
operator ~() Integer
The bit-wise negate operator.
operator ~/(dynamic divisor) Number
The truncating division operator. When dividing by an Imaginary or Complex number, the result will contain an imaginary component. The imaginary component is not truncated; only the real portion of the result is truncated.
inherited

Constants

hundred → const Integer
One hundred, as an Integer.
negOne → const Integer
Negative one, as an Integer.
one → const Integer
One, as an Integer.
ten → const Integer
Ten, as an Integer.
thousand → const Integer
One thousand, as an Integer.
zero → const Integer
Zero, as an Integer.