retrofit? I am just getting DioException when I send invalid requests
yeah in dio interceptor for response callback
how?do u have any resources? I am trying to handle it like this but I am only getting DioException final response = await _apiService.login( request: request ); try { print(response.response.data); } catch (error) { if (error is DioException) { if (error.response != null) { final errorMessage = error.response!.data['message']; print('Backend error message: $errorMessage'); } else { // An error occurred before the response was received print('Request error: ${error.message}'); } } else { // Other types of errors print('Error: $error'); } }
dio literally has a working example in the readme
Use this in catch block then u can print error also
Обсуждают сегодня