nextBranch method

void nextBranch([
  1. String? condition
])

Switches branches linearly by shifting the indent back and forth.

Implementation

void nextBranch([String? condition]) {
  if (_indentLevel > 0) {
    _indentLevel--;
  }

  if (condition == null || condition.isEmpty) {
    writeln('} else {');
  } else {
    writeln('} else if ($condition) {');
  }

  _indentLevel++;
}