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 {
  Object result = await _runWithRetryNew(() async {
    return (await RespCommandsTier1(_client!)
        .jsonArrPop(key: key, path: path, index: index));
  });

  if (result is RespType2<dynamic>) {
    final result1 = result.toArray().payload;
    if (result1 != null && result1.isNotEmpty) {
      return result1[0].payload as String;
    } else {
      throw Exception('jsonArrPop: No elements in the result list');
    }
  }

  final result1 = (result as RespType3<dynamic>).toArray().payload;
  if (result1 != null && result1.isNotEmpty) {
    return result1[0].payload as String;
  } else {
    throw Exception('jsonArrPop: No elements in the result list');
  }
}