get static method

Future get({
  1. bool auth = true,
  2. required String apiURL,
  3. required String lang,
  4. bool isPhone = false,
})

Implementation

static Future<dynamic> get(
    {bool auth = true,
    required String apiURL,
    required String lang,
    bool isPhone = false}) async {
  try {
    var response = await http
        .get(Uri.parse(ApiClient.baseUrl + apiURL),
            headers: ApiClient.headers(auth: auth, token: null, lang: lang))
        .timeout(const Duration(seconds: timeOutDuration));
    return ApiClient.processResponse(response);
  } on SocketException {
    throw FetchDataException('No Internet connection', '');
  } on TimeoutException {
    throw ApiNotRespondingException('API not responded in time', '');
  }
}