toBw method

Bw toBw([
  1. Bw? bw
])

Implementation

Bw toBw([Bw? bw]) {
  if (bw == null) {
    bw = new Bw();
  }
  var jsonNoTxBuf = utf8.encode(json.encode(this.toJSONNoTx()));
  bw.writeVarIntNum(jsonNoTxBuf.length);
  bw.write(jsonNoTxBuf as Uint8List?);
  if (this.tx != null) {
    var txbuf = this.tx!.toBuffer();
    bw.writeVarIntNum(txbuf.length);
    bw.write(txbuf.asUint8List());
  } else {
    bw.writeVarIntNum(0);
  }
  return bw;
}