write abstract method

void write(
  1. Map<String, dynamic> attributes
)

Sets all field keys and values in the specified attributes map. This method is called before the serialization.

Note: if you have complex fields such as nested objects, non generic lists or maps, you need to implement both Serializable and OnDemandSerializable, extend SerializableObject and implement OnDemandSerializable, or specify the corresponding transformers and objectCreators in the Serializer on demand methods.

Compare Serializer.serializeOnDemand() and Serializer.deserializeOnDemand() methods.

attributes['name'] = name;
attributes['price'] = price;

Implementation

void write(Map<String, dynamic> attributes);