Dart BigInt operator-bitwise-and
Syntax & Examples


BigInt.operator-bitwise-and operator

The `operator &` in Dart performs a bitwise AND operation between two BigInt objects.


Syntax of BigInt.operator-bitwise-and

The syntax of BigInt.operator-bitwise-and operator is:

operator &(BigInt other) → BigInt

This operator-bitwise-and operator of BigInt bit-wise and operator.

Parameters

ParameterOptional/RequiredDescription
otherrequiredthe BigInt object to perform the AND operation with


✐ Example

1 Perform Bitwise AND

In this example,

  1. We create two BigInt objects, num1 and num2, initialized with values 10 and 6, respectively.
  2. We use the & operator to perform a bitwise AND operation between num1 and num2.
  3. We print the result to standard output.

Dart Program

void main() {
  BigInt num1 = BigInt.from(10);
  BigInt num2 = BigInt.from(6);
  BigInt result = num1 & num2;
  print('Bitwise AND result: $result');
}

Output

Bitwise AND result: 2

Summary

In this Dart tutorial, we learned about operator-bitwise-and operator of BigInt: the syntax and few working examples with output and detailed explanation for each example.