addBlackList method

Future<Response?> addBlackList({
  1. required String username,
  2. GeneralCallback<Response>? callback,
})

Implementation

Future<Response<dynamic>?> addBlackList({
  required String username,
  GeneralCallback<Response<dynamic>>? callback,
}) async {
  try {
    final Response<dynamic> response = await dio.put(
      '/ban/',
      data: <String, String>{
        'username': username,
      },
    );
    if (callback != null) {
      callback.onSuccess(response);
    }
    return response;
  } on DioException catch (dioException) {
    if (callback == null) {
      rethrow;
    } else {
      handleCrudError(dioException, callback);
    }
  }
  return null;
}