NotificationSeenFunction method

dynamic NotificationSeenFunction({
  1. dynamic notId,
  2. dynamic type,
  3. dynamic context,
})

Implementation

NotificationSeenFunction({notId, type, context}) async {
  var decodedResponse;
  final ApiBody = {"notification_id": notId.toString(), "update_type": type};
  try {
    http.Response response = await http.post(
      Uri.parse('${SDK_BASE_URL}notification_api/update'),
      headers: {
        "Authorization": SignUpController.currentUserToken,
      },
      body: ApiBody,
    );

    decodedResponse = json.decode(response.body);
    seenStatus = decodedResponse['status'];
    (context as Element).reassemble();
  } catch (e) {
    errorListner(
        apiname: 'api/notification_api/update_status',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}