selfprivacy.org.app/lib/logic/models/hive/server_domain.g.dart
NaiJi 129c1bb4c6 Refactor infrastructure
Co-authored-by: Inex Code <inex.code@selfprivacy.org>
2022-05-14 05:54:40 +03:00

88 lines
2.1 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'server_domain.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ServerDomainAdapter extends TypeAdapter<ServerDomain> {
@override
final int typeId = 3;
@override
ServerDomain read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return ServerDomain(
domainName: fields[0] as String,
zoneId: fields[1] as String,
provider:
fields[2] == null ? DnsProvider.Cloudflare : fields[2] as DnsProvider,
);
}
@override
void write(BinaryWriter writer, ServerDomain obj) {
writer
..writeByte(3)
..writeByte(0)
..write(obj.domainName)
..writeByte(1)
..write(obj.zoneId)
..writeByte(2)
..write(obj.provider);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ServerDomainAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class DnsProviderAdapter extends TypeAdapter<DnsProvider> {
@override
final int typeId = 100;
@override
DnsProvider read(BinaryReader reader) {
switch (reader.readByte()) {
case 0:
return DnsProvider.Unknown;
case 1:
return DnsProvider.Cloudflare;
default:
return DnsProvider.Unknown;
}
}
@override
void write(BinaryWriter writer, DnsProvider obj) {
switch (obj) {
case DnsProvider.Unknown:
writer.writeByte(0);
break;
case DnsProvider.Cloudflare:
writer.writeByte(1);
break;
}
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is DnsProviderAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}