Repository: flutter
Issue: Loading the same asset between several widget tests loads infinitely
Labels: a: tests,framework,a: assets,has reproducible steps,P3,team-framework,triaged-framework,found in release: 3.24,found in release: 3.27

### Steps to reproduce

1. Create a test file
2. Create a widget test and call `await rootBundle.loadString(...);`
3. Create a second widget test and call the same method **with the same asset path**

### Expected results

Both tests pass

### Actual results

The second test never completes

### Code sample

<details open><summary>Code sample</summary>

```dart
void main() {
  testWidgets('load assets 1', (tester) async {
    await rootBundle.loadString('assets/flutter_logo.png');
  });

  testWidgets('load assets 2', (tester) async {
    await rootBundle.loadString('assets/flutter_logo.png');
  });
}
```

</details>


### Screenshots or Video

_No response_

### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel master, 3.27.0-1.0.pre.111, on macOS 14.7.1 23H222 darwin-arm64, locale en-US)
    • Flutter version 3.27.0-1.0.pre.111 on channel master at /Users/.../fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 32cb866d3a (5 weeks ago), 2024-10-18 21:33:22 +0200
    • Engine revision 76d310e42c
    • Dart version 3.7.0 (build 3.7.0-34.0.dev)
    • DevTools version 2.40.1

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/.../Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.95.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.100.0

[✓] Connected device (6 available)
    • iPhone 16 Pro (mobile)          • EB579C74-6193-4E82-9ADD-20E2908F59FD • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1 (simulator)
    • iPhone 16 Pro Max (mobile)      • DE1E2B51-91C5-48F3-8E5A-03FD5834F7EF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1 (simulator)
    • iPad Pro 13-inch (M4) (mobile)  • 1F462CE1-F1CE-43D4-AC7F-4A7235A3F31C • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.7.1 23H222 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.7.1 23H222 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 131.0.6778.85

[✓] Network resources
    • All expected network resources are available.
```

</details>