read method
Is called when a value has to be decoded.
Implementation
@override
PersistentShoppingCartItem read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return PersistentShoppingCartItem(
productId: fields[0] as String,
productName: fields[1] as String,
productThumbnail: fields[3] as String?,
productDescription: fields[2] as String?,
productImages: (fields[4] as List?)?.cast<String>(),
unitPrice: fields[5] as double,
quantity: fields[6] as int,
productDetails: (fields[7] as Map?)?.cast<String, dynamic>(),
);
}