Exception in flutter

 } else {

          debugPrint(
              'DoLoginEvent response.statusCode: ${response.statusCode}');
          msgT = 'Wrong Credentials';
          msgC = 'Invalid username or password';
          emit(LoginFailedState(msgT, msgC));
        }
      } on TimeoutException catch (e) {
        debugPrint('DoLoginEvent TimeoutException: $e');
        msgT = 'Timeout';
        msgC = 'Please try again';
        emit(TimeoutExceptionState(msgT, msgC));
      } on SocketException catch (e) {
        debugPrint('DoLoginEvent SocketException: $e');
        msgT = 'Connection Failed';
        msgC = 'Check your internet connection';
        emit(InternetExceptionState(msgT, msgC));
      } catch (e) {
        debugPrint('DoLoginEvent e: $e');
        msgT = 'Something Wrong';
        msgC = 'An error occurred while logging in';
        emit(LoginFailedState(msgT, msgC));
      }





Comments