encodeJson static method

List<int> encodeJson(
  1. Object json, {
  2. String? indent,
  3. bool toStringEncodable = false,
  4. Object? toEncodable(
    1. dynamic
    )?,
})

Encodes a JSON-serializable json object into a list of bytes.

Implementation

static List<int> encodeJson(Object json,
    {String? indent,
    bool toStringEncodable = false,
    Object? Function(dynamic)? toEncodable}) {
  final value = fromJson(json,
      indent: indent,
      toStringEncodable: toStringEncodable,
      toEncodable: toEncodable);
  return encode(value);
}