opt add ab id

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-27 12:16:45 +08:00
parent 5ec0eaa9d7
commit 5616b20879
31 changed files with 148 additions and 28 deletions

View File

@@ -68,11 +68,21 @@ class AbModel {
peers.clear();
}
void addId(String id) async {
void addId(String id, String alias, List<dynamic> tags) {
if (idContainBy(id)) {
return;
}
peers.add(Peer.fromJson({"id": id}));
final peer = Peer.fromJson({
'id': id,
'alias': alias,
'tags': tags,
});
peers.add(peer);
}
void addPeer(Peer peer) {
peers.removeWhere((e) => e.id == peer.id);
peers.add(peer);
}
void addTag(String tag) async {