listToString method

String listToString({
  1. int indentation = 2,
})

Implementation

String listToString({int indentation = 2}) {
  String result = "";
  String indentationStr = " " * indentation;

  result += "$indentationStr[";
  forEach((value) {
    if (value is Map) {
      var temp = value.mapToString(indentation: indentation + 2);
      result += "\n$indentationStr" "\"$temp\",";
    } else if (value is List) {
      result += value.listToString(indentation: indentation + 2);
    } else {
      result += "\n$indentationStr" "\"$value\",";
    }
  });
  result = result.substring(0, result.length - 1);
  result += "\n$indentationStr]";
  return result;
}