initialize method

void initialize()

Ensures the internal _iterableDumper was set.

If not initialized, a IterableDumper matching the mapStyle is created.

Implementation

void initialize() {
  if (_hasIterableDumper) return;

  _hasIterableDumper = true;
  _iterableDumper = switch (mapStyle) {
    NodeStyle.block => IterableDumper.block(
      scalarDumper: scalarDumper,
      commentDumper: _entryStore.dumper,
      onObject: onObject,
      pushAnchor: pushAnchor,
      asLocalTag: asLocalTag,
      inlineNestedFlowIterable: inlineNestedIterable,
      inlineNestedFlowMap: inlineNestedMap,
    ),
    _ => IterableDumper.flow(
      preferInline: inlineNestedIterable,
      scalarDumper: scalarDumper,
      commentDumper: _entryStore.dumper,
      onObject: onObject,
      pushAnchor: pushAnchor,
      asLocalTag: asLocalTag,
      inlineMap: _entryStore.preferInline,
    ),
  }..mapDumper = this;
}