encode static method
Encode the provided object to a Json-formatted String.
If formatted is true, the output will be formatted with two spaces
indentation.
Implementation
static String encode(
Object? object, {
bool formatted = false,
bool encodeForProtocol = false,
}) {
final encoder = JsonEncoder.withIndent(
formatted ? ' ' : null,
encodeForProtocol ? toEncodableForProtocol : toEncodable,
);
return encoder.convert(object);
}