jsonArrTrim method

Future<int> jsonArrTrim(
  1. String key, {
  2. String path = '\$',
  3. int start = 0,
  4. int stop = 0,
})

jsonArrTrim

Implementation

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

  if (result != null && result.isNotEmpty) {
    return result[0].payload as int;
  } else {
    throw Exception('jsonArrTrim: No elements in the result list');
  }
}