getWriteLength method Null safety

  1. @override
int getWriteLength()
override

Gets the length of the payload in bytes when written to a stream.

Implementation

@override
int getWriteLength() {
  var length = 0;
  final enc = MqttEncoding();
  for (final subscription in subscriptions) {
    length += enc.getByteCount(subscription);
  }
  return length;
}