writeRecord method

void writeRecord(
  1. int indent,
  2. Map<String, dynamic> map, {
  3. bool recursive = true,
})

Implementation

void writeRecord(
  int indent,
  Map<String, dynamic> map, {
  bool recursive = true,
}) {
  buffer.write('(\n');
  for (final entry in map.entries) {
    buffer.write('${_generateIndent(indent)}${safeName(entry.key)}: ');
    if (entry.value is List) {
      writeList(indent + 2, entry.value);
    } else if (entry.value is Map) {
      if (recursive) {
        writeRecord(indent + 2, entry.value);
      } else {
        writeMap(indent + 2, entry.value);
      }
    } else if (entry.value is String) {
      writeString(0, entry.value);
    } else {
      writeAny(0, entry.value);
    }
    buffer.write(',\n');
  }
  buffer.write('${_generateIndent(indent - 2)})');
}