Movatterモバイル変換


[0]ホーム

URL:


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

int classabstractfinal

An integer number.

The default implementation ofint is 64-bit two's complement integerswith operations that wrap to that range on overflow.

Note: When compiling to JavaScript, integers are restricted to valuesthat can be represented exactly by double-precision floating point values.The available integer values include all integers between -2^53 and 2^53,and some integers with larger magnitude. That includes some integers largerthan 2^63.The behavior of the operators and methods in theintclass therefore sometimes differs between the Dart VM and Dart codecompiled to JavaScript. For example, the bitwise operators truncate theiroperands to 32-bit integers when compiled to JavaScript.

Classes cannot extend, implement, or mix inint.

See also:

Inheritance
Available extensions

Constructors

int.fromEnvironment(Stringname, {intdefaultValue =0})
Integer value forname in the compilation configuration environment.
const
factory

Properties

addressPointer<Never>

Available onint, provided by theIntAddress extension

The memory address of the underlying data.
getter/setter pair
bitLengthint
Returns the minimum number of bits required to store this integer.
no setter
hashCodeint
Returns a hash code for a numerical value.
no setterinherited
isEvenbool
Returns true if and only if this integer is even.
no setter
isFinitebool
Whether this number is finite.
no setterinherited
isInfinitebool
Whether this number is positive infinity or negative infinity.
no setterinherited
isNaNbool
Whether this number is a Not-a-Number value.
no setterinherited
isNegativebool
Whether this number is negative.
no setterinherited
isOddbool
Returns true if and only if this integer is odd.
no setter
runtimeTypeType
A representation of the runtime type of the object.
no setterinherited
signint
Returns the sign of this integer.
no setteroverride
toJSJSNumber

Available onnum, provided by theNumToJSExtension extension

Converts thisnum to aJSNumber.
no setter

Methods

abs()int
Returns the absolute value of this integer.
override
ceil()int
Returnsthis.
override
ceilToDouble()double
Returnsthis.toDouble().
override
clamp(numlowerLimit,numupperLimit)num
Returns thisnum clamped to be in the rangelowerLimit-upperLimit.
inherited
compareTo(numother)int
Compares this toother.
inherited
floor()int
Returnsthis.
override
floorToDouble()double
Returnsthis.toDouble().
override
gcd(intother)int
Returns the greatest common divisor of this integer andother.
modInverse(intmodulus)int
Returns the modular multiplicative inverse of this integermodulomodulus.
modPow(intexponent,intmodulus)int
Returns this integer to the power ofexponent modulomodulus.
noSuchMethod(Invocationinvocation)→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remainder(numother)num
The remainder of the truncating division ofthis byother.
inherited
round()int
Returnsthis.
override
roundToDouble()double
Returnsthis.toDouble().
override
toDouble()double
This number as adouble.
inherited
toInt()int
Truncates thisnum to an integer and returns the result as anint.
inherited
toRadixString(intradix)String
Converts thisint to a string representation in the givenradix.
toSigned(intwidth)int
Returns the least significantwidth bits of this integer, extending thehighest retained bit to the sign. This is the same as truncating the valueto fit inwidth bits using an signed 2-s complement representation. Thereturned value has the same bit value in all positions higher thanwidth.
toString()String
Returns a string representation of this integer.
override
toStringAsExponential([int?fractionDigits])String
An exponential string-representation of this number.
inherited
toStringAsFixed(intfractionDigits)String
A decimal-point string-representation of this number.
inherited
toStringAsPrecision(intprecision)String
A string representation withprecision significant digits.
inherited
toUnsigned(intwidth)int
Returns the least significantwidth bits of this integer as anon-negative number (i.e. unsigned representation). The returned value haszeros in all bit positions higher thanwidth.
truncate()int
Returnsthis.
override
truncateToDouble()double
Returnsthis.toDouble().
override

Operators

operator %(numother)num
Euclidean modulo of this number byother.
inherited
operator &(intother)int
Bit-wise and operator.
operator *(numother)num
Multiplies this number byother.
inherited
operator +(numother)num
Addsother to this number.
inherited
operator -(numother)num
Subtractsother from this number.
inherited
operator /(numother)double
Divides this number byother.
inherited
operator<(numother)bool
Whether this number is numerically smaller thanother.
inherited
operator<<(intshiftAmount)int
Shift the bits of this integer to the left byshiftAmount.
operator<=(numother)bool
Whether this number is numerically smaller than or equal toother.
inherited
operator ==(Objectother)bool
Test whether this value is numerically equal toother.
inherited
operator >(numother)bool
Whether this number is numerically greater thanother.
inherited
operator >=(numother)bool
Whether this number is numerically greater than or equal toother.
inherited
operator >>(intshiftAmount)int
Shift the bits of this integer to the right byshiftAmount.
operator >>>(intshiftAmount)int
Bitwise unsigned right shift byshiftAmount bits.
operator ^(intother)int
Bit-wise exclusive-or operator.
operator unary-()int
Return the negative value of this integer.
override
operator unary-()num
The negation of this value.
inherited
operator |(intother)int
Bit-wise or operator.
operator ~()int
The bit-wise negate operator.
operator ~/(numother)int
Truncating division operator.
inherited

Static Methods

parse(Stringsource, {int?radix})int
Parsesource as a, possibly signed, integer literal and return its value.
override
tryParse(Stringsource, {int?radix})int?
Parsesource as a, possibly signed, integer literal.
override
  1. Dart
  2. dart:core
  3. int class
dart:core library

[8]ページ先頭

©2009-2025 Movatter.jp