destroy method
关闭长连接、关闭数据库;不退出登录(测试用:客户端与进程同生命周期)。
Implementation
Future<void> destroy() async {
if (_destroyed) return;
_destroyed = true;
conn.stop();
sync.reset();
auth.dispose();
for (final module in modules) {
try {
module.onSignedOut();
} catch (_) {}
}
for (final sub in _subs) {
await sub.cancel();
}
await kv.flush();
await store.close();
await _events.close();
}