addScoped method

void addScoped(
  1. String? begin,
  2. String? end,
  3. Function func, {
  4. bool addTrailingNewline = true,
  5. int nestCount = 1,
})

Scoped increase of the indent level.

For the execution of func the indentation will be incremented.

Implementation

void addScoped(
  String? begin,
  String? end,
  Function func, {
  bool addTrailingNewline = true,
  int nestCount = 1,
}) {
  assert(begin != '' || end != '',
      'Use nest for indentation without any decoration');
  if (begin != null) {
    _sink.write(begin + newline);
  }
  nest(nestCount, func);
  if (end != null) {
    _sink.write(str() + end);
    if (addTrailingNewline) {
      _sink.write(newline);
    }
  }
}