encodeJson static method

Uint8List encodeJson(
  1. Object? simpleObj
)

Decodes a single simple object into a JSON, from the given simpleObj.

Implementation

static Uint8List encodeJson(Object? simpleObj) {
  var jsonEncoder = const JsonEncoder();
  String json = jsonEncoder.convert(simpleObj);

  Utf8Encoder encoder = const Utf8Encoder();
  Uint8List encoded = encoder.convert(json);
  return encoded;
}