From 93988caf5812633fe185a9d40ca650e9bb7f8229 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Tue, 9 May 2023 21:14:34 -0700 Subject: [PATCH] Turn @staticInterop tear-off into closure @staticInterop members will start disallowing tear-offs, so this member should turn into a closure. The static check wasn't added in time, so this is modifying the source code again. --- lib/web_ui/lib/src/engine/text/font_collection.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/web_ui/lib/src/engine/text/font_collection.dart b/lib/web_ui/lib/src/engine/text/font_collection.dart index 95d0fea5eb80f..cef9a9e02306d 100644 --- a/lib/web_ui/lib/src/engine/text/font_collection.dart +++ b/lib/web_ui/lib/src/engine/text/font_collection.dart @@ -130,7 +130,12 @@ class HtmlFontCollection implements FlutterFontCollection { } try { - fontFaces.forEach(domDocument.fonts!.add); + // Since we can't use tear-offs for interop members, this code is faster + // and easier to read with a for loop instead of forEach. + // ignore: prefer_foreach + for (final DomFontFace font in fontFaces) { + domDocument.fonts!.add(font); + } } catch (e) { return FontInvalidDataError(asset); }