toJson method

  1. @override
Map<String, Object?> toJson()
override

Serializes the part to a JSON map.

The returned map must contain a key matching typeKey with a unique string identifier for the part type. See defaultPartConverterRegistry for default part types.

Implementation

@override
Map<String, Object?> toJson() => {
  Part.typeKey: type,
  _Json.content: {
    _Json.id: callId,
    _Json.name: toolName,
    if (arguments != null) _Json.arguments: arguments,
    if (result != null) _Json.result: result,
  },
};