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 entries = <MapEntry>[];
  for (final entry in fields.entries) {
    entries.add(
      MapEntry()
        ..key = entry.key
        ..value = entry.value.toNode(),
    );
  }
  final fieldsNode = IPLDNode()
    ..kind = Kind.MAP
    ..mapValue = (IPLDMap()..entries.addAll(entries));
  return _singleKeyMap('f', _mapNode({'f>': fieldsNode}));
}