read method

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

Is called when a value has to be decoded.

Implementation

@override
SongEntity read(BinaryReader reader) {
  final numOfFields = reader.readByte();
  final fields = <int, dynamic>{
    for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
  };
  return SongEntity()
    ..lastData = fields[0] as String
    ..displayName = fields[1] as String?
    ..id = fields[2] as int
    ..album = fields[3] as String?
    ..albumId = fields[4] as int?
    ..artist = fields[5] as String?
    ..artistId = fields[6] as int?
    ..dateAdded = fields[7] as int?
    ..duration = fields[8] as int?
    ..title = fields[9] as String
    ..artwork = fields[10] as String?
    ..artworkAsBytes = fields[15] as Uint8List?;
}