toJsonStringWithIndent method
Converts the map to a formatted JSON string, with specified indentation.
Example:
var map = {'name': 'John', 'age': 30};
print(map.toJsonStringWithIndent()); // Output: formatted JSON string
Implementation
String toJsonStringWithIndent([int spaces = 2]) {
return JsonEncoder.withIndent(' ' * spaces).convert(this);
}