Repository: flutter
Issue: Using Future.wait and rootBundle.load in tests returns an empty list
Labels: a: tests,framework,a: assets,has reproducible steps,P3,team-framework,triaged-framework,found in release: 3.13,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Create a new flutter project with 2 dummy asset files (`assets/asset01` & `assets/asset02`) and run the attached tests.


### Expected results

All tests should pass (the returned list should not be empty), or an exception should be thrown if `rootBundle` cannot be used this way in tests.

### Actual results

The first 2 tests fail, because the list returned by `Future.wait` is empty. I would have never expected that `Future.wait` can return a `List` of a different length then the supplied `Future` count.

### Code sample

<details><summary>Code sample</summary>


```dart
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('Test with Future.wait', (WidgetTester tester) async {
    TestWidgetsFlutterBinding.ensureInitialized();

    final a = await Future.wait([
      rootBundle.load('assets/asset01'),
      rootBundle.load('assets/asset02'),
    ]);

    expect(a, hasLength(2));
  });

  testWidgets('Test with Future.wait and runAsync', (WidgetTester tester) async {
    TestWidgetsFlutterBinding.ensureInitialized();

    final a = await tester.runAsync(() => Future.wait([
      rootBundle.load('assets/asset01'),
      rootBundle.load('assets/asset02'),
    ]));

    expect(a, hasLength(2));
  });

  testWidgets('Test without Future.wait', (WidgetTester tester) async {
    TestWidgetsFlutterBinding.ensureInitialized();

    final a = [
      await rootBundle.load('assets/asset01'),
      await rootBundle.load('assets/asset02'),
    ];

    expect(a, hasLength(2));
  });
}

```

</details>


### Screenshots or Video

_No response_

### Logs

<details><summary>Logs</summary>

```console
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: an object with length of <2>
  Actual: []
   Which: has length of <0>

When the exception was thrown, this was the stack:
#4      main.<anonymous closure> (file:///home/robin/Projekte/OpenStop/test/widget_test.dart:13:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

This was caught by the test expectation on the following line:
  file:///home/robin/Projekte/OpenStop/test/widget_test.dart line 13
The test description was:
  Test with Future.wait
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: Test with Future.wait

✖ Test with Future.wait
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: an object with length of <2>
  Actual: []
   Which: has length of <0>

When the exception was thrown, this was the stack:
#4      main.<anonymous closure> (file:///home/robin/Projekte/OpenStop/test/widget_test.dart:25:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

This was caught by the test expectation on the following line:
  file:///home/robin/Projekte/OpenStop/test/widget_test.dart line 25
The test description was:
  Test with Future.wait and runAsync
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: Test with Future.wait and runAsync

✖ Test with Future.wait and runAsync
✓ Test without Future.wait
Exited (1)

```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.10.5, on Fedora Linux 38 (Workstation Edition) 6.4.11-200.fc38.x86_64, locale de_DE.UTF-8)
    • Flutter version 3.10.5 on channel stable at /home/robin/Toolkits/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (vor 3 Monaten), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/robin/Toolkits/android
    • Platform android-33, build-tools 30.0.3
    • ANDROID_SDK_ROOT = /home/robin/Toolkits/android
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (Red_Hat-11.0.20.0.8-1.fc38) (build 11.0.20+8)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/lib64/chromium-browser/chromium-browser

[✓] Linux toolchain - develop for Linux desktop
    • clang version 16.0.6 (Fedora 16.0.6-2.fc38)
    • cmake version 3.27.3
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Fedora Linux 38 (Workstation Edition) 6.4.11-200.fc38.x86_64
    • Chrome (web)    • chrome • web-javascript • Chromium 116.0.5845.96 Fedora Project

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

```

</details>