byteToString static method

String byteToString(
  1. List<int?>? bytes
)

Implementation

static String byteToString(List<int?>? bytes) {
  if (bytes == null || bytes.isEmpty) {
    return '';
  }
  int i;
  for (i = 0; i < bytes.length && bytes[i] != 0; ++i) {}
  List<int> validBytes = bytes.sublist(0, i).map((e) => e!).toList();
  String decodedString = utf8.decode(Uint8List.fromList(validBytes));
  return decodedString;
}