encodeMessage method Null safety

  1. @override
ByteData? encodeMessage(
  1. Object? message
)
override

Encodes the specified message in binary.

Returns null if the message is null.

Implementation

@override
ByteData? encodeMessage(Object? message) {
  if (message == null) {
    return null;
  }
  final WriteBuffer buffer = WriteBuffer(startCapacity: _writeBufferStartCapacity);
  writeValue(buffer, message);
  return buffer.done();
}