From 442ac39c4f00802dc46d265a5fc5412df3d2418f Mon Sep 17 00:00:00 2001 From: ekibun Date: Sat, 30 Jan 2021 14:58:00 +0800 Subject: [PATCH] fix jsRef free error --- lib/src/ffi.dart | 4 ++-- pubspec.lock | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/ffi.dart b/lib/src/ffi.dart index dade9a9..e85d1f0 100644 --- a/lib/src/ffi.dart +++ b/lib/src/ffi.dart @@ -41,11 +41,11 @@ abstract class JSRef { if (cache.contains(obj)) return; if (obj is List) { cache.add(obj); - obj.forEach((e) => _callRecursive(e, cb, cache)); + List.from(obj).forEach((e) => _callRecursive(e, cb, cache)); } if (obj is Map) { cache.add(obj); - obj.values.forEach((e) => _callRecursive(e, cb, cache)); + obj.values.toList().forEach((e) => _callRecursive(e, cb, cache)); } if (obj is JSRef) { cb(obj); diff --git a/pubspec.lock b/pubspec.lock index 02fb490..d828156 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -151,4 +151,4 @@ packages: version: "2.1.0-nullsafety.5" sdks: dart: ">=2.12.0-0.0 <3.0.0" - flutter: ">=1.20.0 <2.0.0" + flutter: ">=1.20.0"