Turn @staticInterop tear-off into closure (flutter/engine#41643)

@staticInterop members will start disallowing tear-offs, so this member
should turn into a closure.

Unblocks a roll in the SDK that disallows tear-offs.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [X] All existing and new tests are passing.
This commit is contained in:
Srujan Gaddam
2023-05-01 16:18:32 -07:00
committed by GitHub
parent 94ad16d83a
commit 08ab47dddf

View File

@@ -194,7 +194,12 @@ class FontManager {
if (_downloadedFonts.isEmpty) {
return;
}
_downloadedFonts.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 _downloadedFonts) {
domDocument.fonts!.add(font);
}
}