num class sealed
An integer or floatingpoint number.
It is a compiletime error for any type other than int or double
to attempt to extend or implement num
.
See also:
 int: An integer number.
 double: A doubleprecision floating point number.
 Numbers in A tour of the Dart language.
 Implemented types
 Implementers
 Available Extensions
Constructors
 num()
Properties
 hashCode → int

Returns a hash code for a numerical value.
readonlyoverride
 isFinite → bool

Whether this number is finite.
readonly
 isInfinite → bool

Whether this number is positive infinity or negative infinity.
readonly
 isNaN → bool

Whether this number is a NotaNumber value.
readonly
 isNegative → bool

Whether this number is negative.
readonly
 runtimeType → Type

A representation of the runtime type of the object.
readonlyinherited
 sign → num

Negative one, zero or positive one depending on the sign and
numerical value of this number.
readonly
Methods

abs(
) → num  The absolute value of this number.

ceil(
) → int 
The least integer no smaller than
this
. 
ceilToDouble(
) → double 
Returns the least double integer value no smaller than
this
. 
clamp(
num lowerLimit, num upperLimit) → num 
Returns this num clamped to be in the range
lowerLimit
upperLimit
. 
compareTo(
num other) → int 
Compares this to
other
.override 
floor(
) → int  The greatest integer no greater than this number.

floorToDouble(
) → double 
Returns the greatest double integer value no greater than
this
. 
noSuchMethod(
Invocation invocation) → dynamic 
Invoked when a nonexistent method or property is accessed.
inherited

remainder(
num other) → num 
The remainder of the truncating division of
this
byother
. 
round(
) → int  The integer closest to this number.

roundToDouble(
) → double  The double integer value closest to this value.

toDouble(
) → double  This number as a double.

toInt(
) → int  Truncates this num to an integer and returns the result as an int.

toString(
) → String 
The shortest string that correctly represents this number.
override

toStringAsExponential(
[int? fractionDigits]) → String  An exponential stringrepresentation of this number.

toStringAsFixed(
int fractionDigits) → String  A decimalpoint stringrepresentation of this number.

toStringAsPrecision(
int precision) → String 
A string representation with
precision
significant digits. 
truncate(
) → int 
The integer obtained by discarding any fractional digits from
this
. 
truncateToDouble(
) → double 
Returns the double integer value obtained by discarding any fractional
digits from the double value of
this
.
Operators

operator %(
num other) → num 
Euclidean modulo of this number by
other
. 
operator *(
num other) → num 
Multiplies this number by
other
. 
operator +(
num other) → num 
Adds
other
to this number. 
operator (
num other) → num 
Subtracts
other
from this number. 
operator /(
num other) → double 
Divides this number by
other
. 
operator <(
num other) → bool 
Whether this number is numerically smaller than
other
. 
operator <=(
num other) → bool 
Whether this number is numerically smaller than or equal to
other
. 
operator ==(
Object other) → bool 
Test whether this value is numerically equal to
other
.override 
operator >(
num other) → bool 
Whether this number is numerically greater than
other
. 
operator >=(
num other) → bool 
Whether this number is numerically greater than or equal to
other
. 
operator unary(
) → num  The negation of this value.

operator ~/(
num other) → int  Truncating division operator.