mapToStructureString method
String
mapToStructureString(
{ - int indentation = 2,
})
Implementation
String mapToStructureString({int indentation = 2}) {
String result = "";
String indentationStr = " " * indentation;
if (true) {
result += "{";
forEach((key, value) {
if (value is Map) {
var temp = value.mapToStructureString(indentation: indentation + 2);
result += '\n$indentationStr"$key" : $temp,';
} else if (value is List) {
result +=
'\n$indentationStr"$key" : ${value.listToStructureString(indentation: indentation + 2)},';
} else {
result += '\n$indentationStr"$key" : "$value",';
}
});
result = result.substring(0, result.length - 1);
result += indentation == 2 ? "\n}" : "\n${" " * (indentation - 1)}}";
}
return result;
}