EventMetadata.fromJson constructor

EventMetadata.fromJson(
  1. Object? j
)

Implementation

factory EventMetadata.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return EventMetadata(
    groundingMetadata: switch (json['groundingMetadata']) {
      null => null,
      Object $1 => GroundingMetadata.fromJson($1),
    },
    partial: switch (json['partial']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    turnComplete: switch (json['turnComplete']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    interrupted: switch (json['interrupted']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    longRunningToolIds: switch (json['longRunningToolIds']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"longRunningToolIds" is not a list'),
    },
    branch: switch (json['branch']) {
      null => '',
      Object $1 => decodeString($1),
    },
    customMetadata: switch (json['customMetadata']) {
      null => null,
      Object $1 => protobuf.Struct.fromJson($1),
    },
  );
}