toString method

  1. @override
String toString()
override

Converts bytes to a string by interpreting each byte as a character code.

Negative bytes are converted to their unsigned equivalents first.

Example:

final hello = Byte.fromString('Hello');
print(hello.toString());  // 'Hello'

final bytes = Byte.fromList([65, 66, 67]);
print(bytes.toString());  // 'ABC'

Implementation

@override
String toString() {
  if (isEmpty) return '';
  return String.fromCharCodes(toUnsignedList());
}