Remove unnecessary observables from auth store

This commit is contained in:
tommyxchow 2021-10-16 04:01:09 -04:00
parent b97a8b8975
commit 63a63635c8
2 changed files with 7 additions and 40 deletions

View file

@ -14,22 +14,21 @@ abstract class _AuthBase with Store {
/// Secure storage to store tokens.
final _storage = const FlutterSecureStorage();
/// The current token.
String? _token;
String? get token => _token;
/// Whether the token is valid or not.
var _tokenIsValid = false;
/// The current user's info.
@readonly
UserTwitch? _user;
/// The current token.
@readonly
String? _token;
/// Whether the user is logged in or not.
@readonly
var _isLoggedIn = false;
/// Whether the token is valid or not.
@observable
var _tokenIsValid = false;
/// Authentication headers for Twitch API requests.
@computed
Map<String, String> get headersTwitch => {'Authorization': 'Bearer $_token', 'Client-Id': clientId};

View file

@ -34,23 +34,6 @@ mixin _$AuthStore on _AuthBase, Store {
});
}
final _$_tokenAtom = Atom(name: '_AuthBase._token');
String? get token {
_$_tokenAtom.reportRead();
return super._token;
}
@override
String? get _token => token;
@override
set _token(String? value) {
_$_tokenAtom.reportWrite(value, super._token, () {
super._token = value;
});
}
final _$_isLoggedInAtom = Atom(name: '_AuthBase._isLoggedIn');
bool get isLoggedIn {
@ -68,21 +51,6 @@ mixin _$AuthStore on _AuthBase, Store {
});
}
final _$_tokenIsValidAtom = Atom(name: '_AuthBase._tokenIsValid');
@override
bool get _tokenIsValid {
_$_tokenIsValidAtom.reportRead();
return super._tokenIsValid;
}
@override
set _tokenIsValid(bool value) {
_$_tokenIsValidAtom.reportWrite(value, super._tokenIsValid, () {
super._tokenIsValid = value;
});
}
final _$initAsyncAction = AsyncAction('_AuthBase.init');
@override