From 3843e84640e7fb95418aa3c22cf1f048166d9d9e Mon Sep 17 00:00:00 2001 From: yihuiyang Date: Tue, 7 Nov 2023 15:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DStandardMessageCodec=E4=BB=8E?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=BE=80Flutter=E5=8F=91object=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yihuiyang --- .../src/main/ets/plugin/common/StandardMessageCodec.ets | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMessageCodec.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMessageCodec.ets index 119fad68e5..ffc6948452 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMessageCodec.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMessageCodec.ets @@ -161,7 +161,14 @@ export default class StandardMessageCodec implements MessageCodec { this.writeValue(stream, value); }) } else if (typeof value == 'object') { - this.writeValue(stream, new Map(value.entries())) + let map: Map = new Map(); + Object.keys(value).forEach(key => { + map.set(key, value[key]); + }); + this.writeValue(stream, map); + } else { + throw new Error("Unsupported value: " + value); + stream.writeInt8(StandardMessageCodec.NULL); } return stream } -- Gitee