decodeBase64Packet static method

dynamic decodeBase64Packet(
  1. String msg,
  2. String binaryType
)

Implementation

static decodeBase64Packet(String msg, String binaryType) {
  var type = packetTypeList[msg.codeUnitAt(0)];
  var data = base64.decode(utf8.decode(msg.substring(1).codeUnits));
  if (binaryType == 'arraybuffer') {
    var abv = Uint8List(data.length);
    for (var i = 0; i < abv.length; i++) {
      abv[i] = data[i];
    }
    return {'type': type, 'data': abv.buffer};
  }
  return {'type': type, 'data': data};
}