isStructuredProtocolMessage function

bool isStructuredProtocolMessage(
  1. String messageText
)

Checks if a message text is a structured protocol message.

Implementation

bool isStructuredProtocolMessage(String messageText) {
  try {
    final parsed = jsonDecode(messageText);
    if (parsed is Map<String, dynamic> && parsed.containsKey('type')) {
      return _structuredProtocolTypes.contains(parsed['type']);
    }
  } catch (_) {}
  return false;
}