read method

  1. @override
RuutContact read(
  1. BinaryReader reader
)
override

Is called when a value has to be decoded.

Implementation

@override
RuutContact read(BinaryReader reader) {
  final numOfFields = reader.readByte();
  final fields = <int, dynamic>{
    for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
  };
  return RuutContact(
    id: fields[0] as int,
    contactIdentifier: fields[1] as String?,
    pubsubToken: fields[2] as String?,
    name: fields[3] as String?,
    email: fields[4] as String?,
  );
}