write method

void write(
  1. StringBuffer buffer
)

Implementation

void write(StringBuffer buffer) {
  if (sections.isEmpty) {
    if (options.isEmpty) {
      return;
    }
    buffer.write('[$name]\n');
    _writeSectionProps(buffer);
    buffer.write('\n');
    return;
  }

  if (name != 'branch' && name != 'remote') {
    throw Exception('Unknown field $name');
  }

  for (var subSec in sections) {
    assert(subSec.sections.isEmpty);
    buffer.write('[$name "${subSec.name}"]\n');
    subSec._writeSectionProps(buffer);
    buffer.write('\n');
  }
}