getBlackList method

Future<void> getBlackList({
  1. required GeneralCallback<List<String>> callback,
})

Implementation

Future<void> getBlackList({
  required GeneralCallback<List<String>> callback,
}) async {
  try {
    final Response<String> response = await dio.get<String>(
      '/ban',
    );
    final List<dynamic> list = jsonDecode(response.data!) as List<dynamic>;
    callback.onSuccess(list.map((dynamic e) => e as String).toList());
  } on DioException catch (dioException) {
    handleCrudError(dioException, callback);
  } catch (e) {
    callback.onError(GeneralResponse.unknownError());
    rethrow;
  }
}