Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 858d975

Browse files
authored
[web] Use the new js_util.callMethod(Object, Object) (#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`.
1 parent 41e9b4f commit 858d975

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/web_ui/lib/src/engine/dom.dart

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3278,14 +3278,6 @@ extension DomIntlExtension on DomIntl {
32783278
external JSAny? get v8BreakIterator;
32793279
}
32803280

3281-
/// Similar to [js_util.callMethod] but allows for providing a non-string method
3282-
/// name.
3283-
T _jsCallMethod<T>(Object o, Object method,
3284-
[List<Object?> args = const <Object?>[]]) {
3285-
final Object actualMethod = js_util.getProperty(o, method);
3286-
return js_util.callMethod<T>(actualMethod, 'apply', <Object?>[o, args]);
3287-
}
3288-
32893281
@JS('Intl.Segmenter')
32903282
@staticInterop
32913283
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter
@@ -3310,7 +3302,7 @@ class DomSegments {}
33103302
extension DomSegmentsExtension on DomSegments {
33113303
DomIteratorWrapper<DomSegment> iterator() {
33123304
final DomIterator segmentIterator =
3313-
_jsCallMethod(this, domSymbol.iterator) as DomIterator;
3305+
js_util.callMethod(this, domSymbol.iterator, const <Object?>[]) as DomIterator;
33143306
return DomIteratorWrapper<DomSegment>(segmentIterator);
33153307
}
33163308
}

0 commit comments

Comments
 (0)