AgentEvent.fromJson constructor
AgentEvent.fromJson(
- Object? j
Implementation
factory AgentEvent.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return AgentEvent(
author: switch (json['author']) {
null => null,
Object $1 => decodeString($1),
},
content: switch (json['content']) {
null => null,
Object $1 => Content.fromJson($1),
},
eventTime: switch (json['eventTime']) {
null => null,
Object $1 => protobuf.Timestamp.fromJson($1),
},
stateDelta: switch (json['stateDelta']) {
null => null,
Object $1 => protobuf.Struct.fromJson($1),
},
activeTools: switch (json['activeTools']) {
null => [],
List<Object?> $1 => [for (final i in $1) Tool.fromJson(i)],
_ => throw const FormatException('"activeTools" is not a list'),
},
);
}