deleteAnnouncement method

Future<Response?> deleteAnnouncement({
  1. required Announcement data,
  2. GeneralCallback<Response>? callback,
})

Implementation

Future<Response<dynamic>?> deleteAnnouncement({
  required Announcement data,
  GeneralCallback<Response<dynamic>>? callback,
}) async {
  try {
    final Response<dynamic> response = await dio.delete(
      '/announcements/delete/${data.id}',
      data: data.toUpdateJson(),
    );
    if (callback != null) {
      callback.onSuccess(response);
    }
    return response;
  } on DioException catch (dioException) {
    if (callback == null) {
      rethrow;
    } else {
      handleCrudError(dioException, callback);
    }
  }
  return null;
}