encodeWithType method

String encodeWithType(
  1. Object? object, {
  2. bool formatted = false,
})
inherited

Encode the provided object to a json-formatted String, include class name so that it can be decoded even if th class is unknown. If formatted is true, the output will be formatted with two spaces indentation.

Implementation

String encodeWithType(
  Object? object, {
  bool formatted = false,
}) {
  return encode(
    wrapWithClassName(object),
    formatted: formatted,
  );
}