get static method

Future<Map<String, dynamic>> get(
  1. String url
)

Implementation

static Future<Map<String, dynamic>> get(String url) async {
  var headers = {'Content-Type': "application/json"};

  var requestUrl = _mBaseUrl + url;

  if (getSessionToken() != null) {
    headers["Authorization"] = "Bearer ${getSessionToken()}";
  }

  if (getAppId() != null) {
    headers["app-id"] = getAppId()!;
  }

  try {
    final response = await Dio().get(requestUrl, options: Options(headers: headers));
    if (response.statusCode! >= 200 && response.statusCode! < 300) {
      return response.data;
    }
    throw HttpUtil.makeTPException(response);
  } on DioException catch (e) {
    throw HttpUtil.makeTPException(e.response);
  } catch(e){
    rethrow;
  }
}