Update MobX Fix auth state not triggering onAuthState changed due to same value

Update MobX Fix auth state not triggering onAuthState changed due to same value

OmarHatem committed Mar 6, 2023 at 18:42 UTC 44a9ad7487277776888766349d9eb2b0c8612609
2 files changed +12 -6
lib/store/authentication_store.dart
+9 -3
@@ -4,7 +4,7 @@ part 'authentication_store.g.dart';
4
5 class AuthenticationStore = AuthenticationStoreBase with _$AuthenticationStore;
6
7 -enum AuthenticationState { uninitialized, installed, allowed }
7 +enum AuthenticationState { uninitialized, installed, allowed, _reset }
8
9 abstract class AuthenticationStoreBase with Store {
10 AuthenticationStoreBase() : state = AuthenticationState.uninitialized;
@@ -13,8 +13,14 @@ abstract class AuthenticationStoreBase with Store {
13 AuthenticationState state;
14
15 @action
16 - void installed() => state = AuthenticationState.installed;
16 + void installed() {
17 + state = AuthenticationState._reset;
18 + state = AuthenticationState.installed;
19 + }
20
21 @action
19 - void allowed() => state = AuthenticationState.allowed;
22 + void allowed() {
23 + state = AuthenticationState._reset;
24 + state = AuthenticationState.allowed;
25 + }
26 }
pubspec_base.yaml
+3 -3
@@ -22,8 +22,8 @@ dependencies:
22 barcode_scan2: ^4.2.1
23 http: ^0.13.4
24 path_provider: ^2.0.11
25 - mobx: 2.0.7+4
26 - flutter_mobx: ^2.0.6+1
25 + mobx: ^2.1.4
26 + flutter_mobx: ^2.0.6+5
27 flutter_slidable: ^2.0.0
28 share_plus: ^4.0.10
29 # date_range_picker: ^1.0.6
@@ -73,7 +73,7 @@ dev_dependencies:
73 flutter_test:
74 sdk: flutter
75 build_runner: ^2.1.11
76 - mobx_codegen: ^2.0.7
76 + mobx_codegen: ^2.1.1
77 build_resolvers: ^2.0.9
78 hive_generator: ^1.1.3
79 flutter_launcher_icons: ^0.9.3