writeKey method

  1. @override
void writeKey(
  1. String key
)
override

Writes a mapping key for a YAML object.

This should position the generator to expect a value next.

Implementation

@override
void writeKey(String key) {
  if (_contextStack.isEmpty || _contextStack.last != YamlNodeType.MAPPING) {
    throw ObjectGeneratorException('Cannot write key outside mapping');
  }

  _newline();
  _indent();
  _buffer.write('$key:');
  _expectValue = true;
}