jsonArrLen method
jsonArrLen
Implementation
Future<int> jsonArrLen(String key, {String path = '\$'}) async {
List<RespType<dynamic>>? result = await _runWithRetryNew(() async {
return (await RespCommandsTier1(_client!)
.jsonArrLen(key: key, path: path))
.toArray()
.payload;
});
if (result != null && result.isNotEmpty) {
return result[0].payload as int; // 确保 payload 是 int 类型
} else {
throw Exception('jsonArrLen: No elements in the result list');
}
}