toBinaryString property

String toBinaryString

Converts the number to a binary (base-2) string representation.

This method first converts the number to an integer using toInt, then generates a binary string representation of that integer.

Returns: A string representing the binary representation of the number.

Example:

print(10.toBinaryString); // Outputs: 1010

Implementation

String get toBinaryString => toInt().toRadixString(2);