read method
Is called when a value has to be decoded.
Implementation
@override
Asset read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
final stored = (fields[0] as Map).cast<String, dynamic>();
// Convert the stored map to ensure it's the expected Map<String, dynamic>
// type before passing to Asset.fromJson to avoid type casting issues
final convertedMap = convertToJsonMap(stored);
return Asset.fromJson(convertedMap);
}