writeKey method
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;
}