hasSingleBit property
bool
hasSingleBit
Tests if this unsigned 32-bit integer has a single bit set, which also means that it is a power of two.
Implementation
bool get hasSingleBit => this != 0 && this & (this - 1) == 0;