File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -65,15 +65,15 @@ class AuthModel with ChangeNotifier {
65
65
// static final inAppReview = InAppReview.instance;
66
66
var hasRequestedReview = false ;
67
67
68
- List <Account >? _accounts;
68
+ List <Account > _accounts = [] ;
69
69
int ? activeAccountIndex;
70
70
late StreamSubscription <Uri ?> _sub;
71
71
bool loading = false ;
72
72
73
73
List <Account >? get accounts => _accounts;
74
74
Account ? get activeAccount {
75
- if (activeAccountIndex == null || _accounts == null ) return null ;
76
- return _accounts! [activeAccountIndex! ];
75
+ if (activeAccountIndex == null || _accounts.isEmpty ) return null ;
76
+ return _accounts[activeAccountIndex! ];
77
77
}
78
78
79
79
String get token => activeAccount! .token;
@@ -89,7 +89,7 @@ class AuthModel with ChangeNotifier {
89
89
if (activeAccountIndex == index) {
90
90
activeAccountIndex = null ;
91
91
}
92
- _accounts! .removeAt (index);
92
+ _accounts.removeAt (index);
93
93
// Save
94
94
final prefs = await SharedPreferences .getInstance ();
95
95
await prefs.setString (StorageKeys .accounts, json.encode (_accounts));
You can’t perform that action at this time.
0 commit comments