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 {