genericBeaHttpGet method

Future<Response> genericBeaHttpGet(
  1. String url
)

Implementation

Future<Response> genericBeaHttpGet(String url) async {
  try{

    if(!await _beaNetworkManager!.checkNetworkConnection()){
      throw new BeaInternetException("No internet connection");
    }

    String? token = await _storage.read(key: KeyUtils.KEY_TOKEN_SESSION);

    Map<String, String> headers = {
      "Authorization": "Bearer $token",
      "Content-Type": "application/json",
      "User-agent": "http.agent"
    };

    Response response = await genericHttpGet(url, headers);

    if(response.statusCode == 400){
      print(response.data);
      throw new BeaInternetException("Input format value not valid");
    }

    return response;

  }on TimeoutException catch (_) {
    print('Request Timeout');
    FLog.error(
        className: this.runtimeType.toString(),
        methodName: "genericHttpGet",
        text: 'Request Timeout');
    throw new BeaInternetException("Request Timeout");
  }on BeaInternetException catch (e){
    print('BEA HTTP GET request error');
    FLog.error(
        className: this.runtimeType.toString(),
        methodName: "genericBeaHttpGet",
        text: 'BEA HTTP GET request error - Input value format not valid - $e');
    throw new Exception(e);
  }on Exception catch (e){
    print('BEA HTTP GET request error');
    FLog.error(
        className: this.runtimeType.toString(),
        methodName: "genericBeaHttpGet",
        text: 'BEA HTTP Get request error - $e');
    throw e;
  }
}