From f1e518a0d7a1a38551c78c7fe9bc4676df51773a Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 13 May 2025 12:05:52 +0100 Subject: [PATCH] fix: logout --- lib/login.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/login.dart b/lib/login.dart index 7ffc147..ac11c5e 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -77,14 +77,17 @@ class LoginData extends ValueNotifier { LoginData() : super(null) { super.addListener(() async { - final data = json.encode(LoginAccount.toJson(value)); - await _storage.write(key: _storageKey, value: data); + if (value != null) { + final data = json.encode(LoginAccount.toJson(value)); + await _storage.write(key: _storageKey, value: data); + } else { + await _storage.delete(key: _storageKey); + } }); } - Future logout() async { + void logout() { super.value = null; - await _storage.delete(key: _storageKey); } Future load() async {