processMessages method
Records payload and hands it to the processor.
payload is whatever MessageProcessor.processMessages takes: decoded
JSON, a parsed message or a list of either. Each message is recorded
before it is processed, so a message the processor rejects is in the
trace too, as what the agent sent; the rejection is thrown as it would
have been.
Implementation
void processMessages(Object? payload) {
for (final Map<String, Object?> json in _messagesOf(payload)) {
// A copy, taken now: the data model can adopt an updateDataModel's
// value and write into it as the person types, at which point the
// message is no longer what the agent sent.
_steps.add(
GenUiMessageStep(
_clock.elapsed,
_redactedMessage(_copy(json)! as Map<String, Object?>),
),
);
}
_changes.notify();
processor.processMessages(payload);
}