mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: blacklist (#501)
This commit is contained in:
committed by
GitHub
parent
a8428e52d2
commit
edf84fcc8f
26
lib/utils/set_int_adapter.dart
Normal file
26
lib/utils/set_int_adapter.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class SetIntAdapter extends TypeAdapter<Set<int>> {
|
||||
@override
|
||||
final int typeId = 11;
|
||||
|
||||
@override
|
||||
Set<int> read(BinaryReader reader) {
|
||||
return reader.readIntList().toSet();
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Set<int> obj) {
|
||||
writer.writeIntList(obj.toList());
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is SetIntAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
Reference in New Issue
Block a user