decodeLine static method

Map<String, Object?> decodeLine(
  1. String line
)

Decode one NDJSON line into a message map.

Throws FormatException on garbage input — the host converts that into a schema error envelope rather than dying.

Implementation

static Map<String, Object?> decodeLine(String line) {
  final decoded = jsonDecode(line);
  if (decoded is! Map) {
    throw FormatException(
      'ZAP lines are JSON objects; got '
      '${decoded.runtimeType}',
    );
  }
  return decoded.cast<String, Object?>();
}