selfprivacy.org.app/lib/logic/models/hive/server_domain.g.dart

88 lines
2.1 KiB
Dart
Raw Normal View History

2021-01-06 17:35:57 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'server_domain.dart';
2021-01-06 17:35:57 +00:00
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ServerDomainAdapter extends TypeAdapter<ServerDomain> {
2021-01-06 17:35:57 +00:00
@override
final int typeId = 3;
@override
ServerDomain read(BinaryReader reader) {
2021-01-06 17:35:57 +00:00
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return ServerDomain(
2021-03-26 13:38:39 +00:00
domainName: fields[0] as String,
zoneId: fields[1] as String,
provider:
2022-05-24 18:55:39 +00:00
fields[2] == null ? DnsProvider.cloudflare : fields[2] as DnsProvider,
2021-01-06 17:35:57 +00:00
);
}
@override
void write(BinaryWriter writer, ServerDomain obj) {
2021-01-06 17:35:57 +00:00
writer
..writeByte(3)
2021-01-06 17:35:57 +00:00
..writeByte(0)
2021-01-21 07:35:38 +00:00
..write(obj.domainName)
2021-01-06 17:35:57 +00:00
..writeByte(1)
..write(obj.zoneId)
..writeByte(2)
..write(obj.provider);
2021-01-06 17:35:57 +00:00
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ServerDomainAdapter &&
2021-01-06 17:35:57 +00:00
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:
2022-05-24 18:55:39 +00:00
return DnsProvider.unknown;
case 1:
2022-05-24 18:55:39 +00:00
return DnsProvider.cloudflare;
default:
2022-05-24 18:55:39 +00:00
return DnsProvider.unknown;
}
}
@override
void write(BinaryWriter writer, DnsProvider obj) {
switch (obj) {
2022-05-24 18:55:39 +00:00
case DnsProvider.unknown:
writer.writeByte(0);
break;
2022-05-24 18:55:39 +00:00
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;
}