parseLine static method
Parses one NDJSON line. Blank lines return null; garbage throws
FormatException; a line whose JSON is not an object throws
WireProtocolException.
Implementation
static Map<String, dynamic>? parseLine(String line) {
final trimmed = line.trim();
if (trimmed.isEmpty) return null;
final decoded = jsonDecode(trimmed);
if (decoded is! Map<String, dynamic>) {
throw WireProtocolException('NDJSON line must hold a JSON object');
}
return decoded;
}