fix
This commit is contained in:
@@ -74,9 +74,8 @@ class Auth with ChangeNotifier {
|
||||
_authenticated = false;
|
||||
_key = SecureKey.random(constants.sodium, 32);
|
||||
_user = "";
|
||||
mountList?.clear(notify: false);
|
||||
|
||||
notifyListeners();
|
||||
|
||||
mountList?.clear();
|
||||
}
|
||||
}
|
||||
|
@@ -16,11 +16,7 @@ class MountList with ChangeNotifier {
|
||||
|
||||
MountList(this._auth) {
|
||||
_auth.mountList = this;
|
||||
_auth.addListener(() {
|
||||
if (_auth.authenticated) {
|
||||
_fetch();
|
||||
}
|
||||
});
|
||||
_auth.addListener(_listener);
|
||||
}
|
||||
|
||||
List<Mount> _mountList = [];
|
||||
@@ -177,8 +173,12 @@ class MountList with ChangeNotifier {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
void clear({bool notify = true}) {
|
||||
_mountList = [];
|
||||
if (!notify) {
|
||||
return;
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -198,4 +198,16 @@ class MountList with ChangeNotifier {
|
||||
|
||||
Future.delayed(Duration(seconds: 1), _fetch);
|
||||
}
|
||||
|
||||
void _listener() {
|
||||
if (_auth.authenticated) {
|
||||
_fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_auth.removeListener(_listener);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user