isPowerOf2 function Null safety

bool isPowerOf2(
  1. int n
)

CHeck if n is power of 2.

Implementation

bool isPowerOf2(int n) => (n & (n - 1)) == 0;