From f55ed6aa70f64aadff95e417128e7d14400d0c9d Mon Sep 17 00:00:00 2001 From: Srujan Gaddam <58529443+srujzs@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:41:23 -0700 Subject: [PATCH] Change JSBoxedDartObject to JSAny (flutter/engine#51634) Closes https://github.com/dart-lang/sdk/issues/55256 https://github.com/flutter/engine/commit/d7ce346fba22869c58dbb69cb395bd905434af54 added code to avoid the less performant boxing of JSBoxedDartObject and instead use backend-specific logic to externalize and internalize the UniqueRef until we get a better solution from dart:js_interop. On the JS backends, this relied on casting to and from JSAny, as its representation type is just Object. However, this callback that takes in the UniqueRef as an arg is still typed as accepting JSBoxedDartObject, leading to a cast failure on the JS backends, since the representation type is JSObject. The fix is to use JSAny. On dart2wasm, this makes no difference, as the underlying representation type does not change. --- .../lib/web_ui/lib/src/engine/canvaskit/native_memory.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/native_memory.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/native_memory.dart index 0ef83b4b98..c1e592d242 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/native_memory.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/native_memory.dart @@ -21,7 +21,7 @@ import 'package:ui/src/engine.dart'; /// 5. The finalizer function is called with the SkPaint as the sole argument. /// 6. We call `delete` on SkPaint. DomFinalizationRegistry _finalizationRegistry = DomFinalizationRegistry( - (JSBoxedDartObject boxedUniq) { + (JSAny boxedUniq) { final UniqueRef uniq = boxedUniq.fromJSWrapper as UniqueRef; uniq.collect(); }.toJS