jsonStrlen method

Future<List<int?>> jsonStrlen(
  1. String key, {
  2. String path = '\$',
})

jsonStrlen

Implementation

Future<List<int?>> jsonStrlen(String key, {String path = '\$'}) async {
  Object result = await _runWithRetryNew(() async {
    return (await RespCommandsTier1(_client!)
        .jsonStrlen(key: key, path: path));
  });

  if (result is RespType2<dynamic>) {
    final result1 = result.toArray().payload;

    if (result1 != null) {
      return result1.map((item) {
        if (item is RespType2<int>) {
          return item.payload;
        } else {
          return null;
        }
      }).toList(growable: false);
    }
    return [];
  }

  final result1 = (result as RespType3<dynamic>).toArray().payload;
  if (result1 != null) {
    return result1.map((item) {
      if (item is RespType3<int>) {
        return item.payload;
      } else {
        return null;
      }
    }).toList(growable: false);
  }
  return [];
}