fetchConfig method

Future fetchConfig()

Implementation

Future<dynamic> fetchConfig() async {
  try {
    var response = await _dio
        .get("/v1/rating/sdk/config", queryParameters: {"lang": lang});
    var data = response.data;

    print(data);
    print(data.runtimeType);
    return data;
  } on DioError catch (e) {
    // The request was made and the server responded with a status code
    // that falls out of the range of 2xx and is also not 304.
    if (e.response != null) {
      print("\n ERROR \n");
      print(e);
      print(e.response?.data);
      print(e.response?.headers);
      print(e.response?.requestOptions);

      throw UnimplementedError("Handle the error case");
    } else {
      print("Catch message");
      print(e.response);
      print(e.response?.data["tags"]);
      // Something happened in setting up or sending the request that triggered an Error
      print(e.requestOptions);
      print(e.message);
      print(e);
      throw UnimplementedError("Handle the error case without data");
    }
  }
}