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

@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.

ee3ce32c7c was the original change, but the static error didn't make it into the Dart SDK, so this is fixing another tear-off.

- [] 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.
This commit is contained in:
Srujan Gaddam
2023-05-10 17:18:14 -07:00
committed by GitHub
parent 9fce37c015
commit df4bd5d036

View File

@@ -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);
}