toJSON method
Converts the object to a JSON string representation.
The indent
parameter specifies the number of spaces to use for indentation.
Set indent
to 0 or a negative value for no indentation.
Returns the JSON string representation of the object.
Implementation
@override
String toJSON({int indent = 0}) {
if (indent > 0) {
return JsonEncoder.withIndent(' ' * indent).convert(toMap());
} else {
return json.encode(toMap());
}
}