Repository: flutter
Issue: `window.viewConfiguration.visible` throws in widget tests
Labels: a: tests,framework,has reproducible steps,a: null-safety,P2,found in release: 2.2,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

```dart
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('example', (WidgetTester tester) async {
    // TestWidgetsFlutterBinding.ensureInitialized(); // does not change anything when used
    // tester.binding.createViewConfiguration(); // does not change anything when used
    expect(tester.binding.window.viewConfiguration.visible, isNotNull);
  });
}
```

**Expected results:** <!-- what did you want to see? -->

`tester.binding.window.viewConfiguration.visible` should not throw in tests.

**Actual results:** <!-- what did you see? -->

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following _TypeError was thrown running a test:
type 'Null' is not a subtype of type 'ViewConfiguration'

When the exception was thrown, this was the stack:
#0      TestWindow.viewConfiguration (dart:ui/window.dart:286:25)
#1      main.<anonymous closure> (file:///Users/jonas/Documents/projects/sentry-dart/flutter/test/binding_test.dart:6:34)
#2      main.<anonymous closure> (file:///Users/jonas/Documents/projects/sentry-dart/flutter/test/binding_test.dart:4:26)
#3      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:156:29)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

The test description was:
  example
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: example
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
There's no other code, so nothing to find for flutter analyze
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.3.1 20E241 darwin-x64, locale de-DE)
    • Flutter version 2.2.1 at /Users/jonas/Documents/projects/flutter
    • Framework revision 02c026b03c (7 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jonas/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Users/jonas/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/jonas/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.3.1 20E241 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 90.0.4430.212

• No issues found!
```

</details>