writeList method

void writeList(
  1. int indent,
  2. List list
)

Implementation

void writeList(int indent, List<dynamic> list) {
  buffer.write('[\n');
  for (final value in list) {
    buffer.write(_generateIndent(indent));
    if (value is Map) {
      writeMap(
        indent + 2,
        value.map(
          (key, value) => MapEntry(key.toString(), value),
        ),
      );
    } else if (value is List) {
      writeList(indent + 2, value);
    } else if (value is String) {
      writeString(0, value);
    } else {
      writeAny(0, value);
    }
    buffer.write(',\n');
  }
  buffer.write('${_generateIndent(indent - 2)}]');
}