applyBlock method

String applyBlock(
  1. String? tag,
  2. String? anchor,
  3. int nodeIndent,
  4. String node,
)

Applies the tag and anchor in its own line just before the node. Apply to block collections only.

Implementation

String applyBlock(String? tag, String? anchor, int nodeIndent, String node) {
  // Inline the properties and check if any are present.
  // PS: This "if-case" is intentional. Expressive :)
  if (applyInline(tag, anchor, '').trim() case final properties
      when properties.isNotEmpty) {
    return '$properties\n${' ' * nodeIndent}${node.trimLeft()}';
  }

  return node;
}