EMStreamChunk.fromJson constructor
~english Creates a stream chunk from a JSON map.
Param map The JSON map.
Return The stream chunk instance. ~end
~chinese 从 JSON map 创建流式消息块。
Param map JSON map。
Return 流式消息块实例。 ~end
Implementation
factory EMStreamChunk.fromJson(Map<String, dynamic> map) {
return EMStreamChunk._private(
status: _streamStatusFromInt(map['status'] ?? 3),
errorCode: map['errorCode'] ?? 0,
finishReason: map['finishReason'] ?? 0,
chunk: map['text'] ?? '',
customType: map['customType'],
);
}