writeList method
void
writeList(
- int indent,
- List list, {
- bool stringAsAny = false,
})
Implementation
void writeList(
int indent,
List<dynamic> list, {
/// If `true`, `String` will be treated as a generic value, thus no quote characters
/// will be written.
bool stringAsAny = false,
}) {
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),
),
stringAsAny: stringAsAny,
);
} else if (value is List) {
writeList(
indent + 2,
value,
stringAsAny: stringAsAny,
);
} else if (stringAsAny) {
writeAny(0, value);
} else {
if (value is String) {
writeString(0, value);
} else {
writeAny(0, value);
}
}
buffer.write(',\n');
}
buffer.write('${_generateIndent(indent - 2)}]');
}