Hexadecimal class
Represents an integer as a hexadecimal number.
- Inheritance
- Available extensions
Constructors
- Hexadecimal.new(String hexStr)
- Constructs a instance.
Properties
- hashCode → int
-
Returns the same hash as the int with the same value.
no setterinherited
- isFinite → bool
-
Whether this Number represents a finite value.
no setterinherited
- isInfinite → bool
-
Whether this Number represents infinity.
no setterinherited
- 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 setterinherited
- isNaN → bool
-
Whether this Number represents a value .
no setterinherited
- isNegative → bool
-
Whether this number is less than zero.
no setterinherited
- 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, adouble
otherwise.no setterinherited - value → int
-
All Real subclasses must be able to provide their value as a dart:core num.
no setterinherited
Methods
-
abs(
) → Integer -
The absolute value, returned as an Integer.
Returns itself if its value is greater than or equal to zero.
inherited
-
asFraction(
) → Fraction -
Returns the fractional type of the value
inherited
-
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.
inherited
-
ceil(
) → Number -
Returns the least Number having integer components no smaller than this Number.
inherited
-
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
andupperLimit
are expected to benum
or `Number' objects.inherited -
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 -
exp(
) → Number -
Returns the natural exponentiation of a number.
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.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nthRoot(
double nth, {bool allRoots = false}) → dynamic -
Get the nth root of the number
inherited
-
pow(
num exponent) → Number -
Find the square root of the number
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
-
roundTo(
[int decimalPlaces = 0]) → Number -
This method shifts the decimal point
decimalPlaces
places to the right, rounds to the nearest integer, and then shifts the decimal point back to the left by the same amount. The default value ofdecimalPlaces
is0
.inherited -
sqrt(
) → Number -
Find the square root of the number
inherited
-
toDouble(
) → double -
Converts this Number to a
dart:core double
.inherited -
toFraction(
[int precision = 64]) → List< int> -
Approximates the double as a simple fraction with the numerator and denominator as elements of a list.
Example:
inherited
-
toFractionString(
) → String -
Returns a string representation of the double as a simple fraction.
Example:
inherited
-
toInt(
) → int -
Converts this Number to a
dart:core int
.inherited -
toJson(
) → Map< String, int> -
Support
dart:json
stringify.inherited -
toMixedFraction(
) → List< int> -
Converts the double to a mixed fraction represented as a list of integers where the first element is the whole number,
the second is the numerator of the fractional part, and the third is the denominator of the fractional part.
Example:
inherited
-
toMixedFractionString(
) → String -
Returns a string representation of the double as a mixed fraction.
Example:
inherited
-
toString(
) → String -
A string representation of this object.
override
-
toWords(
{String lang = 'en', String? conjunction, Currency? currency, int decimalPlaces = 2, bool useOrdinal = false}) → String -
Available on Number, provided by the NumberToWordsExtension extension
-
truncate(
) → Number -
Returns a truncated value.
inherited
Operators
-
operator %(
dynamic divisor) → Number -
The modulo operator.
inherited
-
operator &(
dynamic n) → Number -
Bitwise AND.
inherited
-
operator *(
dynamic multiplicand) → Number -
Returns the product of this Number and the
multiplicand
(a Number or num). This Number is unaffected.inherited -
operator +(
dynamic addend) → Number -
Addition operator.
inherited
-
operator -(
dynamic subtrahend) → Number -
Returns the difference of this Number and the
subtrahend
(a Number or num). This Number is unaffected.inherited -
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.
inherited
-
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.inherited -
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.
inherited
-
operator ^(
dynamic exponent) → Number -
The power operator (note: NOT bitwise XOR).
inherited
-
operator unary-(
) → Integer -
Negation operator.
inherited
-
operator |(
dynamic n) → Number -
Bitwise OR.
inherited
-
operator ~(
) → Integer -
The bit-wise negate operator.
inherited
-
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