isBinary property

bool get isBinary

Returns true if string is Binary string. Binary String: only contains 0(s) and 1(s).

"xyz".isBinary;    // false
"10".isBinary;     // true

Implementation

bool get isBinary => toInt(base: 2) != null;