// GENERATED CODE - DO NOT MODIFY BY HAND part of 'cache.dart'; // ************************************************************************** // TypeAdapterGenerator // ************************************************************************** class CacheAdapter extends TypeAdapter { @override final int typeId = 22; @override Cache read(BinaryReader reader) { final numOfFields = reader.readByte(); final fields = { for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), }; return Cache() ..libraryTracks = fields[0] == null ? [] : (fields[0] as List).cast() ..loggedTrackId = fields[1] as String? ..history = (fields[2] as List).cast() ..sorts = (fields[3] as List).cast() ..searchHistory = (fields[4] as List).cast() ..threadsWarning = fields[5] as bool ..lastUpdateCheck = fields[6] as DateTime? ..favoritesPlaylistId = fields[7] as String?; } @override void write(BinaryWriter writer, Cache obj) { writer ..writeByte(8) ..writeByte(0) ..write(obj.libraryTracks) ..writeByte(1) ..write(obj.loggedTrackId) ..writeByte(2) ..write(obj.history) ..writeByte(3) ..write(obj.sorts) ..writeByte(4) ..write(obj.searchHistory) ..writeByte(5) ..write(obj.threadsWarning) ..writeByte(6) ..write(obj.lastUpdateCheck) ..writeByte(7) ..write(obj.favoritesPlaylistId); } @override int get hashCode => typeId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is CacheAdapter && runtimeType == other.runtimeType && typeId == other.typeId; } class SearchHistoryItemAdapter extends TypeAdapter { @override final int typeId = 20; @override SearchHistoryItem read(BinaryReader reader) { final numOfFields = reader.readByte(); final fields = { for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), }; return SearchHistoryItem( fields[1] as dynamic, fields[0] as SearchHistoryItemType, ); } @override void write(BinaryWriter writer, SearchHistoryItem obj) { writer ..writeByte(2) ..writeByte(0) ..write(obj.type) ..writeByte(1) ..write(obj.data); } @override int get hashCode => typeId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SearchHistoryItemAdapter && runtimeType == other.runtimeType && typeId == other.typeId; } class SearchHistoryItemTypeAdapter extends TypeAdapter { @override final int typeId = 21; @override SearchHistoryItemType read(BinaryReader reader) { switch (reader.readByte()) { case 0: return SearchHistoryItemType.track; case 1: return SearchHistoryItemType.album; case 2: return SearchHistoryItemType.artist; case 3: return SearchHistoryItemType.playlist; default: return SearchHistoryItemType.track; } } @override void write(BinaryWriter writer, SearchHistoryItemType obj) { switch (obj) { case SearchHistoryItemType.track: writer.writeByte(0); break; case SearchHistoryItemType.album: writer.writeByte(1); break; case SearchHistoryItemType.artist: writer.writeByte(2); break; case SearchHistoryItemType.playlist: writer.writeByte(3); break; } } @override int get hashCode => typeId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SearchHistoryItemTypeAdapter && runtimeType == other.runtimeType && typeId == other.typeId; } // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** Cache _$CacheFromJson(Map json) => Cache() ..libraryTracks = (json['libraryTracks'] as List?) ?.map((e) => e as String) .toList() ?? [] ..history = (json['history'] as List?) ?.map((e) => Track.fromJson(e as Map)) .toList() ?? [] ..sorts = (json['sorts'] as List?) ?.map((e) => e == null ? null : Sorting.fromJson(e as Map)) .toList() ?? [] ..searchHistory = (json['searchHistory2'] as List?) ?.map((e) => SearchHistoryItem.fromJson(e as Map)) .toList() ?? [] ..threadsWarning = json['threadsWarning'] as bool? ?? false ..lastUpdateCheck = json['lastUpdateCheck'] == null ? null : DateTime.parse(json['lastUpdateCheck'] as String) ..favoritesPlaylistId = json['favoritesPlaylistId'] as String?; Map _$CacheToJson(Cache instance) => { 'libraryTracks': instance.libraryTracks, 'history': instance.history.map((e) => e.toJson()).toList(), 'sorts': instance.sorts.map((e) => e?.toJson()).toList(), 'searchHistory2': instance.searchHistory.map((e) => e.toJson()).toList(), 'threadsWarning': instance.threadsWarning, 'lastUpdateCheck': instance.lastUpdateCheck?.toIso8601String(), 'favoritesPlaylistId': instance.favoritesPlaylistId, }; SearchHistoryItem _$SearchHistoryItemFromJson(Map json) => SearchHistoryItem( json['data'], SearchHistoryItem._searchHistoryItemTypeFromJson(json['type'] as int), ); Map _$SearchHistoryItemToJson(SearchHistoryItem instance) => { 'type': SearchHistoryItem._searchHistoryItemTypeToJson(instance.type), 'data': instance.data, };