@@ -23,7 +23,7 @@ Future<ApiResponse<String>> pingAPI() async {
2323 if (data['stat' ] == 'ok' ) {
2424 return ApiResponse <String >(data: data['result' ]);
2525 }
26- } on DioError catch (e) {
26+ } on DioException catch (e) {
2727 debugPrint (e.message);
2828 } catch (e) {
2929 debugPrint ('Error $e ' );
@@ -88,15 +88,14 @@ Future<ApiResponse<bool>> loginUser(
8888 }
8989 ApiResponse <StatusModel > status = await sessionStatus ();
9090 if (status.hasData) {
91- Preferences .saveId (status.data! ,
92- username: username, password: password);
91+ Preferences .saveId (status.data! , username: username, password: password);
9392 }
9493 askMediaPermission ();
9594 return ApiResponse <bool >(
9695 data: true ,
9796 );
9897 }
99- } on DioError catch (e) {
98+ } on DioException catch (e) {
10099 debugPrint (e.message);
101100 } catch (e) {
102101 debugPrint ('Error $e ' );
@@ -108,10 +107,7 @@ Future<ApiResponse<bool>> loginUser(
108107}
109108
110109Future <ApiResponse <StatusModel >> sessionStatus () async {
111- Map <String , String > queries = {
112- 'format' : 'json' ,
113- 'method' : 'pwg.session.getStatus'
114- };
110+ Map <String , String > queries = {'format' : 'json' , 'method' : 'pwg.session.getStatus' };
115111
116112 try {
117113 Response response = await ApiClient .get (queryParameters: queries);
@@ -125,7 +121,7 @@ Future<ApiResponse<StatusModel>> sessionStatus() async {
125121 data: StatusModel .fromJson (data['result' ]),
126122 );
127123 }
128- } on DioError catch (e) {
124+ } on DioException catch (e) {
129125 debugPrint (e.message);
130126 } catch (e) {
131127 debugPrint ('Session Status Error: $e ' );
@@ -139,18 +135,15 @@ Future<ApiResponse<StatusModel>> sessionStatus() async {
139135}
140136
141137Future <String ?> communityStatus () async {
142- Map <String , String > queries = {
143- 'format' : 'json' ,
144- 'method' : 'community.session.getStatus'
145- };
138+ Map <String , String > queries = {'format' : 'json' , 'method' : 'community.session.getStatus' };
146139
147140 try {
148141 Response response = await ApiClient .get (queryParameters: queries);
149142 var data = json.decode (response.data);
150143 if (data['stat' ] == 'ok' ) {
151144 return data['result' ]['real_user_status' ];
152145 }
153- } on DioError catch (e) {
146+ } on DioException catch (e) {
154147 debugPrint (e.message);
155148 } catch (e) {
156149 debugPrint ('Error $e ' );
@@ -169,7 +162,7 @@ Future<ApiResponse<InfoModel>> getInfo() async {
169162 data: InfoModel .fromJson (data['result' ]),
170163 );
171164 }
172- } on DioError catch (e) {
165+ } on DioException catch (e) {
173166 debugPrint (e.message);
174167 } catch (e) {
175168 debugPrint ('Error $e ' );
@@ -180,18 +173,14 @@ Future<ApiResponse<InfoModel>> getInfo() async {
180173}
181174
182175Future <ApiResponse <List <String >>> getMethods () async {
183- Map <String , String > queries = {
184- 'format' : 'json' ,
185- 'method' : 'reflection.getMethodList'
186- };
176+ Map <String , String > queries = {'format' : 'json' , 'method' : 'reflection.getMethodList' };
187177
188178 try {
189179 Response response = await ApiClient .get (queryParameters: queries);
190180 Map <String , dynamic > data = json.decode (response.data);
191- final List <String > methods =
192- data['result' ]['methods' ].map <String >((e) => e.toString ()).toList ();
181+ final List <String > methods = data['result' ]['methods' ].map <String >((e) => e.toString ()).toList ();
193182 return ApiResponse <List <String >>(data: methods);
194- } on DioError catch (e) {
183+ } on DioException catch (e) {
195184 debugPrint (e.message);
196185 } catch (e) {
197186 debugPrint ('Error $e ' );
0 commit comments