jsonArrPop method

Future<String> jsonArrPop(
  1. String key, {
  2. String path = '\$',
  3. int index = 0,
})

jsonArrPop

Implementation

Future<String> jsonArrPop(
  String key, {
  String path = '\$',
  int index = 0,
}) async {
  List<RespType<dynamic>>? result = await _runWithRetryNew(() async {
    return (await RespCommandsTier1(_client!)
            .jsonArrPop(key: key, path: path, index: index))
        .toArray()
        .payload;
  });

  if (result != null && result.isNotEmpty) {
    return result[0].payload as String; // 确保 payload 是 string 类型
  } else {
    throw Exception('jsonArrPop: No elements in the result list');
  }
}