mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
27 lines
573 B
Dart
27 lines
573 B
Dart
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;
|
|
}
|