From 8259db4b301bd01e500999c50c4270ebefaba0fd Mon Sep 17 00:00:00 2001 From: Mouad Debbar Date: Fri, 26 May 2023 14:31:47 -0400 Subject: [PATCH] [web] Use the new js_util.callMethod(Object, Object) (flutter/engine#42352) Now that `js_util.callMethod` can take an `Object` as a method name, we can use it directly for methods that are accessed through a `Symbol`. --- engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart index 82aeb6ea7d..44f943ed05 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart @@ -3278,14 +3278,6 @@ extension DomIntlExtension on DomIntl { external JSAny? get v8BreakIterator; } -/// Similar to [js_util.callMethod] but allows for providing a non-string method -/// name. -T _jsCallMethod(Object o, Object method, - [List args = const []]) { - final Object actualMethod = js_util.getProperty(o, method); - return js_util.callMethod(actualMethod, 'apply', [o, args]); -} - @JS('Intl.Segmenter') @staticInterop // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter @@ -3310,7 +3302,7 @@ class DomSegments {} extension DomSegmentsExtension on DomSegments { DomIteratorWrapper iterator() { final DomIterator segmentIterator = - _jsCallMethod(this, domSymbol.iterator) as DomIterator; + js_util.callMethod(this, domSymbol.iterator, const []) as DomIterator; return DomIteratorWrapper(segmentIterator); } }