getNotification static method

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

Implementation

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

  var requestUrl = 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;
  }
}