TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
>>> operator is the unsigned right shift (or logical right shift) operator in Dart. It shifts the binary representation of the left operand to the right by the number of bits specified by the right operand, filling the newly vacated most significant bits (leftmost bits) with zeros.
This behavior contrasts with the arithmetic right shift operator (>>), which performs sign extension by filling the vacated bits with a copy of the original sign bit (1 for negative numbers, 0 for positive numbers).
Bitwise Mechanics
Dart integers are represented using two’s complement. When the>>> operator is evaluated:
- The bits of
valueare shifted right byshiftAmountpositions. - The bits shifted off the right end (least significant bits) are discarded.
- The vacated bits on the left end (most significant bits) are populated strictly with
0.
shiftAmount (right operand) must be a non-negative integer. Passing a negative shift amount to any bitwise shift operator in Dart throws a RangeError.
Platform-Specific Behavior
Because Dart targets multiple platforms, the underlying bit-width of the integer dictates where the zero-fill occurs, how large shift amounts are handled, and the resulting sign:- Native (Dart VM / AOT):
- Integers are 64-bit. The
>>>operator shifts zeros into the 64th bit. - Shifting by an amount
>= 64pushes all bits out of the 64-bit boundary, resulting in0.
- Integers are 64-bit. The
- Web (Compiled to JavaScript):
- Bitwise operations in JavaScript treat operands as 32-bit integers. When running Dart on the web,
>>>truncates the operand to 32 bits before shifting, and the zero-fill occurs at the 32nd bit. - Crucially,
>>>on the web acts as a signed-to-unsigned 32-bit conversion. It always results in a positive number (or0), regardless of the shift amount. - The
shiftAmountis masked to 5 bits (evaluated asshiftAmount % 32). Consequently, shifting by32or greater wraps around. For example,x >>> 32evaluates identically tox >>> 0.
- Bitwise operations in JavaScript treat operands as 32-bit integers. When running Dart on the web,
Code Examples
Positive Integer Shift For positive integers,>>> yields the exact same result as >> because the sign bit is already 0.
0, fundamentally altering the numerical magnitude and resulting in a positive number. The exact result depends on the platform’s bit-width.
>>> 0)
The behavior of shifting by 0 diverges significantly between platforms due to the web’s unsigned 32-bit conversion semantics.
Master Dart with Deep Grasping Methodology!Learn More





