mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
refactors (#539)
This commit is contained in:
@@ -5,17 +5,17 @@ import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
class ServerStore extends PersistentStore {
|
||||
ServerStore() : super('server');
|
||||
|
||||
void put(ServerPrivateInfo info) {
|
||||
void put(Spi info) {
|
||||
box.put(info.id, info);
|
||||
box.updateLastModified();
|
||||
}
|
||||
|
||||
List<ServerPrivateInfo> fetch() {
|
||||
List<Spi> fetch() {
|
||||
final ids = box.keys;
|
||||
final List<ServerPrivateInfo> ss = [];
|
||||
final List<Spi> ss = [];
|
||||
for (final id in ids) {
|
||||
final s = box.get(id);
|
||||
if (s != null && s is ServerPrivateInfo) {
|
||||
if (s != null && s is Spi) {
|
||||
ss.add(s);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class ServerStore extends PersistentStore {
|
||||
box.updateLastModified();
|
||||
}
|
||||
|
||||
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
||||
void update(Spi old, Spi newInfo) {
|
||||
if (!have(old)) {
|
||||
throw Exception('Old spi: $old not found');
|
||||
}
|
||||
@@ -40,5 +40,5 @@ class ServerStore extends PersistentStore {
|
||||
put(newInfo);
|
||||
}
|
||||
|
||||
bool have(ServerPrivateInfo s) => box.get(s.id) != null;
|
||||
bool have(Spi s) => box.get(s.id) != null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user