DecimalFixedPoint class final
A decimal fixed-point value.
The raw integer stores the mathematical value scaled by 10 ^ decimals.
- Implemented types
Constructors
- DecimalFixedPoint({required BigInt raw, required int decimals, FixedPointSignedness signedness = FixedPointSignedness.unsigned, int totalBits = 64})
-
Creates a decimal fixed-point value from a raw scaled integer.
const
- DecimalFixedPoint.parse(String value, {required int decimals, FixedPointRoundingMode rounding = FixedPointRoundingMode.strict, FixedPointSignedness signedness = FixedPointSignedness.unsigned, int totalBits = 64})
-
Parses
valueas a decimal fixed-point number.factory
Properties
- decimals → int
-
The number of decimal places represented by raw.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- kind → String
-
The upstream-compatible kind tag for this value.
no setter
- raw → BigInt
-
The raw integer value scaled by
10 ^ decimals.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signedness → FixedPointSignedness
-
Whether raw may be negative.
final
- totalBits → int
-
The bit width used to validate raw.
final
Methods
-
compareTo(
DecimalFixedPoint other) → int -
Compares this object to another object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDecimalString(
) → String - Formats this value as a decimal string.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator +(
DecimalFixedPoint other) → DecimalFixedPoint -
Adds
other, requiring both values to use the same shape. -
operator -(
DecimalFixedPoint other) → DecimalFixedPoint -
Subtracts
other, requiring both values to use the same shape. -
operator ==(
Object other) → bool -
The equality operator.
override