maxRemoteDebugResponseJsonLength function

int maxRemoteDebugResponseJsonLength(
  1. String kind
)

Maximum raw JSON bytes that fit in a DebugResponseFrame for kind.

The response payload also carries a four-byte sequence, a one-byte kind length, and the UTF-8 kind itself. Debug producers use this exact remainder so a locally valid document can never be rejected by encodeFrame.

Implementation

int maxRemoteDebugResponseJsonLength(String kind) {
  final kindBytes = _encodeDebugKind(kind);
  return remoteFramePayloadLimit(FrameType.debugResponse) -
      5 -
      kindBytes.length;
}