write method

bool write(
  1. MsgPackWriter writer,
  2. dynamic object
)

Appends to a MsgPackWriter provided writer the object as a extension.

  • writer: The base MsgPackWriter used in the main object serialization process
  • object: The target object

Returns true if the object is serializable via the current extension, false otherwise

Implementation

bool write(MsgPackWriter writer, dynamic object) {
  var extWriter = MsgPackWriter();

  if (doWrite(extWriter, object)) {
    writer.writeExt(type, extWriter.takeBytes());

    return true;
  }

  return false;
}