Repository: flutter
Issue: Unable to render all fonts from Google Fonts in a ListView
Labels: framework,c: performance,f: scrolling,a: typography,has reproducible steps,P3,found in release: 2.2,found in release: 2.3,team-framework,triaged-framework

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

1. Run `flutter create bug`.
2. Add google_fonts to pubspec.yaml 
3. Create a widget that returns a ListView.builder()
4. For list items, return the following widget:
      ```
      Text(
        'Font',
        style: GoogleFonts.asMap().values.toList()[index](),
      );
      ```
5. Run the app and scroll the ListView.

**Expected results:** List should contain text with all the available Google Fonts and should scroll smoothly, without lag.

**Actual results:** List shows lag when scrolling and after some scroll, the app entirely freezes.

<details>
  <summary>Logs</summary>

**flutter run --verbose**
```
[  +87 ms] executing: [C:\src\flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +74 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] cc9b78fc5c4a4d2d51316d9626523336230a89a9
[   +1 ms] executing: [C:\src\flutter\flutter/] git tag --points-at cc9b78fc5c4a4d2d51316d9626523336230a89a9
[  +58 ms] Exit code 0 from: git tag --points-at cc9b78fc5c4a4d2d51316d9626523336230a89a9
[   +1 ms] 2.1.0-10.0.pre
[  +56 ms] executing: [C:\src\flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +43 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms] origin/dev
[        ] executing: [C:\src\flutter\flutter/] git ls-remote --get-url origin
[  +37 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[  +81 ms] executing: [C:\src\flutter\flutter/] git rev-parse --abbrev-ref HEAD
[  +37 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] dev
[ +101 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +73 ms] executing: C:\Users\imaac\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +53 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +81 ms] executing: C:\Users\imaac\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +21 ms] Skipping pub get: version match.
[  +53 ms] Found plugin path_provider at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider-2.0.1\
[  +11 ms] Found plugin path_provider_linux at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.0.0\
[   +4 ms] Found plugin path_provider_macos at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_macos-2.0.0\
[   +6 ms] Found plugin path_provider_windows at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.1\
[ +129 ms] Found plugin path_provider at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider-2.0.1\
[   +2 ms] Found plugin path_provider_linux at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.0.0\
[   +2 ms] Found plugin path_provider_macos at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_macos-2.0.0\
[   +3 ms] Found plugin path_provider_windows at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.1\
[  +27 ms] Generating C:\Users\imaac\Desktop\Projects\FontRenderTest\font_render_test\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +88 ms] List of devices attached
[  +27 ms] List of devices attached
[  +57 ms] Launching lib\main.dart on Chrome in debug mode...
[ +125 ms] Updating assets
[ +104 ms] Waiting for connection from debug service on Chrome...
[  +26 ms] Found plugin path_provider at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider-2.0.1\
[   +3 ms] Found plugin path_provider_linux at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.0.0\
[   +2 ms] Found plugin path_provider_macos at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_macos-2.0.0\
[   +4 ms] Found plugin path_provider_windows at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.1\
[  +31 ms] Found plugin path_provider at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider-2.0.1\
[   +1 ms] Found plugin path_provider_linux at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.0.0\
[   +1 ms] Found plugin path_provider_macos at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_macos-2.0.0\
[   +3 ms] Found plugin path_provider_windows at C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.1\
[ +145 ms] <- reset
[  +10 ms] C:\src\flutter\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\src\flutter\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\src\flutter\flutter\bin\cache\flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
C:\Users\imaac\AppData\Local\Temp\flutter_tools.afc350b7\flutter_tool.eb41053b\app.dill --libraries-spec file:///C:/src/flutter/flutter/bin/cache/flutter_web_sdk/libraries.json --packages
C:\Users\imaac\Desktop\Projects\FontRenderTest\font_render_test\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root
C:\Users\imaac\AppData\Local\Temp\flutter_tools.afc350b7\flutter_tools.607f5665 --filesystem-scheme org-dartlang-app --initialize-from-dill build\c7922d95bf4a2462b75c84a97c312edb.cache.dill.track.dill --platform
file:///C:/src/flutter/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill --no-sound-null-safety
[  +18 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+21669 ms] Waiting for connection from debug service on Chrome... (completed in 21.9s)
[   +1 ms] Synced 35.1MB.
[   +1 ms] <- accept
[   +1 ms] Caching compiled dill
[ +553 ms] Using Opening in existing browser session.

[+4731 ms] [CHROME]:
[   +2 ms] [CHROME]:DevTools listening on ws://127.0.0.1:65507/devtools/browser/018dc31f-e571-4d8a-9810-d5c430dca37e
[ +749 ms] DwdsInjector: Received request for entrypoint at http://localhost:65472/main_module.bootstrap.js
[  +16 ms] MetadataProvider: Loading debug metadata...
[  +41 ms] MetadataProvider: Loaded debug metadata (no sound null safety)
[  +16 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:65472/main_module.bootstrap.js
[+10842 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: false
[ +612 ms] DevHandler: Debug service listening on ws://127.0.0.1:49165/7JR-6pW1Z-k=/ws

[  +18 ms] Debug service listening on ws://127.0.0.1:49165/7JR-6pW1Z-k=/ws
[   +1 ms] Running with unsound null safety
[   +1 ms] For more information see https://dart.dev/null-safety/unsound-null-safety
[   +8 ms]   To hot restart changes while running, press "r" or "R".
[   +4 ms] For a more detailed help message, press "h". To quit, press "q".
[+68954 ms] null
[  +15 ms] null
[  +25 ms] null
```

**flutter analyze**
```
Analyzing font_render_test...                                           
No issues found! (ran in 4.2s)
```

**flutter doctor -v**

```
[√] Flutter (Channel dev, 2.1.0-10.0.pre, on Microsoft Windows [Version 10.0.19042.985], locale en-IN)
    • Flutter version 2.1.0-10.0.pre at C:\src\flutter\flutter
    • Framework revision cc9b78fc5c (3 months ago), 2021-02-25 13:26:03 -0800
    • Engine revision a252ec09b7
    • Dart version 2.13.0 (build 2.13.0-77.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\imaac\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30907.101
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.2)
    • VS Code at C:\Users\imaac\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.22.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.985]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 90.0.4430.212
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 90.0.818.56

• No issues found!
```

</details>