Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:core
  3. num class
num
description

num classsealed

An integer or floating-point number.

It is a compile-time error for any type other thanint ordoubleto attempt to extend or implementnum.

See also:

Implemented types
Implementers
Available extensions

Properties

hashCodeint
Returns a hash code for a numerical value.
no setteroverride
isFinitebool
Whether this number is finite.
no setter
isInfinitebool
Whether this number is positive infinity or negative infinity.
no setter
isNaNbool
Whether this number is a Not-a-Number value.
no setter
isNegativebool
Whether this number is negative.
no setter
runtimeTypeType
A representation of the runtime type of the object.
no setterinherited
signnum
Negative one, zero or positive one depending on the sign andnumerical value of this number.
no setter
toJSJSNumber

Available onnum, provided by theNumToJSExtension extension

Converts thisnum to aJSNumber.
no setter

Methods

abs()num
The absolute value of this number.
ceil()int
The least integer no smaller thanthis.
ceilToDouble()double
Returns the least double integer value no smaller thanthis.
clamp(numlowerLimit,numupperLimit)num
Returns thisnum clamped to be in the rangelowerLimit-upperLimit.
compareTo(numother)int
Compares this toother.
override
floor()int
The greatest integer no greater than this number.
floorToDouble()double
Returns the greatest double integer value no greater thanthis.
noSuchMethod(Invocationinvocation)→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remainder(numother)num
The remainder of the truncating division ofthis byother.
round()int
The integer closest to this number.
roundToDouble()double
The double integer value closest to this value.
toDouble()double
This number as adouble.
toInt()int
Truncates thisnum to an integer and returns the result as anint.
toString()String
The shortest string that correctly represents this number.
override
toStringAsExponential([int?fractionDigits])String
An exponential string-representation of this number.
toStringAsFixed(intfractionDigits)String
A decimal-point string-representation of this number.
toStringAsPrecision(intprecision)String
A string representation withprecision significant digits.
truncate()int
The integer obtained by discarding any fractional digits fromthis.
truncateToDouble()double
Returns the double integer value obtained by discarding any fractionaldigits from the double value ofthis.

Operators

operator %(numother)num
Euclidean modulo of this number byother.
operator *(numother)num
Multiplies this number byother.
operator +(numother)num
Addsother to this number.
operator -(numother)num
Subtractsother from this number.
operator /(numother)double
Divides this number byother.
operator<(numother)bool
Whether this number is numerically smaller thanother.
operator<=(numother)bool
Whether this number is numerically smaller than or equal toother.
operator ==(Objectother)bool
Test whether this value is numerically equal toother.
override
operator >(numother)bool
Whether this number is numerically greater thanother.
operator >=(numother)bool
Whether this number is numerically greater than or equal toother.
operator unary-()num
The negation of this value.
operator ~/(numother)int
Truncating division operator.

Static Methods

parse(Stringinput, [numonError(Stringinput)?])num
Parses a string containing a number literal into a number.
tryParse(Stringinput)num?
Parses a string containing a number literal into a number.
  1. Dart
  2. dart:core
  3. num class
dart:core library

[8]ページ先頭

©2009-2025 Movatter.jp