doWrite method Null safety

  1. @override
bool doWrite(
  1. MsgPackWriter writer,
  2. dynamic object
)
override

Writes the object to the provided MsgPackWriter writer

  • writer: The MsgPackWriter to use to serialize the object
  • object: The target object

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

Implementation

@override
bool doWrite(MsgPackWriter writer, dynamic object) {
  if (object is DateTime) {
    writer.writeString(object.toIso8601String());

    return true;
  }

  return false;
}