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

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

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