serialize method

  1. @override
String serialize(
  1. dynamic object
)
override

Implementation

@override
String serialize(dynamic object) {
  dynamic parsedObject = _toMap(object, {});

  if (parsedObject is String) {
    return parsedObject;
  }

  dynamic cleanedUpObject = parsedObject;

  // Beautify the JSON with indentation
  if (prettyPrint) {
    return const JsonEncoder.withIndent('  ').convert(cleanedUpObject);
  } else {
    return jsonEncode(cleanedUpObject);
  }
}