@@ -12,13 +12,13 @@ mixin HasApiService<T extends NyApiService> {
1212 T ? _apiService;
1313
1414 /// Set the onSuccess callback
15- onApiSuccess (Function (Response response, dynamic data) onSuccess) {
15+ void onApiSuccess (Function (Response response, dynamic data) onSuccess) {
1616 _apiService ?? = apiService;
1717 _apiService! .onSuccess (onSuccess);
1818 }
1919
2020 /// Set the onError callback
21- onApiError (Function (dynamic error) onError) {
21+ void onApiError (Function (dynamic error) onError) {
2222 _apiService ?? = apiService;
2323 _apiService! .onError (onError);
2424 }
@@ -69,7 +69,7 @@ class Auth {
6969 }
7070
7171 /// Get the user data.
72- static data ({String ? key}) {
72+ static dynamic data ({String ? key}) {
7373 if (key != null ) {
7474 Map <String , dynamic >? bpData = Backpack .instance.read (key);
7575 return (bpData? .containsKey (key) ?? false ) ? bpData! [key] : null ;
@@ -78,7 +78,7 @@ class Auth {
7878 }
7979
8080 /// Update the auth user data.
81- static update (Function (dynamic data) update) async {
81+ static Future < void > update (Function (dynamic data) update) async {
8282 dynamic data = await NyStorage .read (key ());
8383 dynamic updatedData = await update (data);
8484 await authenticate (data: updatedData);
@@ -98,19 +98,19 @@ class Auth {
9898 }
9999
100100 /// Sync the auth user data to the backpack.
101- static syncToBackpack () async {
101+ static Future < void > syncToBackpack () async {
102102 dynamic data = await NyStorage .readJson (key ());
103103 Backpack .instance.save (key (), data);
104104 }
105105}
106106
107107/// Authenticate user
108- authAuthenticate ({dynamic data}) async {
108+ Future < void > authAuthenticate ({dynamic data}) async {
109109 await Auth .authenticate (data: data);
110110}
111111
112112/// Logout user
113- authLogout () async {
113+ Future < void > authLogout () async {
114114 await Auth .logout ();
115115}
116116
@@ -120,22 +120,22 @@ Future<bool> authIsAuthenticated() async {
120120}
121121
122122/// Get the user data
123- authData ({String ? key}) {
123+ dynamic authData ({String ? key}) {
124124 return Auth .data (key: key);
125125}
126126
127127/// Update the auth user data
128- authUpdate (Function (dynamic data) update) async {
128+ Future < void > authUpdate (Function (dynamic data) update) async {
129129 await Auth .update (update);
130130}
131131
132132/// Sync the auth user data to the backpack
133- authSyncToBackpack () async {
133+ Future < void > authSyncToBackpack () async {
134134 await Auth .syncToBackpack ();
135135}
136136
137137/// Get the auth key
138- authKey () {
138+ String authKey () {
139139 return Auth .key ();
140140}
141141
0 commit comments