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

99 lines
2.4 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: fields[2] == null
? DnsProviderType.cloudflare
: fields[2] as DnsProviderType,
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 DnsProviderTypeAdapter extends TypeAdapter<DnsProviderType> {
@override
final int typeId = 100;
@override
DnsProviderType read(BinaryReader reader) {
switch (reader.readByte()) {
case 0:
return DnsProviderType.unknown;
case 1:
return DnsProviderType.cloudflare;
2023-01-05 09:16:30 +00:00
case 2:
2023-05-17 16:58:15 +00:00
return DnsProviderType.desec;
case 3:
return DnsProviderType.digitalOcean;
default:
return DnsProviderType.unknown;
}
}
@override
void write(BinaryWriter writer, DnsProviderType obj) {
switch (obj) {
case DnsProviderType.unknown:
writer.writeByte(0);
break;
case DnsProviderType.cloudflare:
writer.writeByte(1);
break;
2023-05-17 16:58:15 +00:00
case DnsProviderType.desec:
2023-01-05 09:16:30 +00:00
writer.writeByte(2);
break;
2023-05-17 16:58:15 +00:00
case DnsProviderType.digitalOcean:
writer.writeByte(3);
break;
}
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is DnsProviderTypeAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}