toNode method

  1. @override
IPLDNode toNode()
override

Encode this selector as an IPLDNode using the official compact DAG-CBOR/DAG-JSON selector schema.

Implementation

@override
IPLDNode toNode() {
  final body = <String, IPLDNode>{};
  if (subset != null) body['subset'] = subset!.toNode();
  if (label != null) body['label'] = _stringNode(label!);
  if (index != null) body['index'] = _intNode(index!);
  if (onlyIf != null) body['onlyIf'] = onlyIf!.toNode();
  return _singleKeyMap('.', _mapNode(body));
}