read method Null safety

  1. @override
void read(
  1. Map<String, dynamic> attributes
)
override

Reads all field keys and values from the specified attributes map. This method is called after the de-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.

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

Implementation

@override
void read(Map<String, dynamic> attributes) {
  typeName = attributes['typeName'];
  hostname = attributes['hostname'];
  port = attributes['port'];
  username = attributes['username'];
  socketTypeName = attributes['socketType'];
  authenticationName = attributes['authentication'];
  authenticationAlternativeName = attributes['authenticationAlternative'];
}