Uint32 class
- Implemented types
Constructors
- Uint32(int value)
-
factory
- Uint32.from(int value)
-
Builds from a plain Dart int, accepting negative values by taking
their two's-complement bit pattern (masked to 32 bits) instead of
throwing like Uint32.new does — e.g.
Uint32.from(-1) == Uint32.max. Mirrors the maskingInt32.newalready does for negative input.factory - Uint32.fromBigInt(BigInt value)
-
factory
- Uint32.unsafe(int _value)
-
Raw bit-pattern constructor —
valuemust already be in[0, 0xFFFFFFFF]. Prefer Uint32.new for arbitrary Dart ints.const
Properties
Methods
-
addChecked(
Uint32 other) → Uint32 -
compareTo(
Uint32 other) → int -
Compares this object to another object.
override
-
mulChecked(
Uint32 other) → Uint32 -
The true product of two u32s can reach ~2^64 — still safe as a
double (well under 2^53 is false here, so this uses the same
wrapping
*plus a division round-trip check rather than forming the full product directly). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subChecked(
Uint32 other) → Uint32 -
toBigInt(
) → BigInt -
toBytes(
[Endian endian = Endian.big]) → Uint8List -
toDouble(
) → double -
toHexString(
{bool padded = true}) → String -
toInt(
) → int -
Always safe:
_valueis always< 2^32, far inside the double-safe integer range. -
toInt128(
) → Int128 - Zero-extending widen, then reinterpret — always non-negative and exact for the same reason as toInt64.
-
toInt32(
) → Int32 -
Same-width bit reinterpretation (two's complement) — e.g.
Uint32.max.toInt32() == Int32.minusOne. -
toInt64(
) → Int64 - Zero-extending widen, then reinterpret — always non-negative and exact, since a 32-bit magnitude always fits in a positive Int64.
-
toString(
) → String -
A string representation of this object.
override
-
toUint128(
) → Uint128 - Zero-extending widen. Always exact.
-
toUint256(
) → Uint256 - Zero-extending widen. Always exact.
-
toUint64(
) → Uint64 - Zero-extending widen. Always exact.
Operators
-
operator %(
Uint32 other) → Uint32 -
operator &(
Uint32 other) → Uint32 -
operator *(
Uint32 other) → Uint32 -
Multiply, keeping only the low 32 bits (wrapping). Two 32-bit
magnitudes multiplied directly can reach ~2^64 — unsafe as a double
on web — so this decomposes into 16-bit limbs first, the same way
Uint64.operator*andInt32.operator*do. -
operator +(
Uint32 other) → Uint32 -
operator -(
Uint32 other) → Uint32 -
operator <(
Uint32 other) → bool -
operator <<(
int n) → Uint32 -
operator <=(
Uint32 other) → bool -
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
Uint32 other) → bool -
operator >=(
Uint32 other) → bool -
operator >>(
int n) → Uint32 - Logical right shift (the only kind that applies to an unsigned type). Right shift only shrinks magnitude, so this is always safe directly.
-
operator ^(
Uint32 other) → Uint32 -
operator unary-(
) → Uint32 -
operator |(
Uint32 other) → Uint32 -
operator ~(
) → Uint32 -
operator ~/(
Uint32 other) → Uint32 -
Both operands are always
< 2^32(well within the double-safe range), so plainintdivision/modulo here is exact directly — no BigInt or limb decomposition needed.