encodeJsonStreaming method

Uint8List encodeJsonStreaming()

Streaming equivalent of encodeJson (#lzdartstreamingjson): builds the JSON via writeJson into a StringBuffer instead of jsonEncode(toWire()), so the intermediate Map<String, Object> (and the inner List/Map allocations for the batch variants) is never materialized.

Implementation

Uint8List encodeJsonStreaming() {
  final buf = StringBuffer();
  writeJson(buf);
  return Uint8List.fromList(utf8.encode(buf.toString()));
}