write method
Is called when a value has to be encoded.
Implementation
@override
void write(BinaryWriter writer, Asset obj) {
writer
..writeByte(1)
..writeByte(0)
// We use the raw protocol config map to avoid issues with nested types
// and inconsistent toJson/fromJson behaviour with the Asset class.
..write(obj.protocol.config);
}