Repository: flutter
Issue: _CastError: Null check operator used on a null value after resuming an app from the background
Labels: c: crash,framework,a: production,a: null-safety,P3,needs repro info,team-framework,triaged-framework

## Steps to Reproduce

This is an automated anonymous crash report. 
According to breadcrumbs, it happened a dozen seconds after resuming an app from the background.
1 second before the exception there are 2 entries like that (sentry breadcrumbs):
`Another exception was thrown: Instance of 'DiagnosticsProperty<void>'`

**Expected results:** 
No exception is thrown.

**Actual results:** 
```
_CastError: Null check operator used on a null value
  File "framework.dart", line 3087, in Element.widget
  File "framework.dart", line 4929, in ProxyElement.widget
  File "framework.dart", line 5036, in InheritedElement.widget
  File "inherited_notifier.dart", line 99, in _InheritedNotifierElement.widget
  File "framework.dart", line 4014, in Element.dependOnInheritedElement
  File "framework.dart", line 4886, in StatefulElement.dependOnInheritedElement
  File "framework.dart", line 4022, in Element.dependOnInheritedWidgetOfExactType
  File "focus_scope.dart", line 391, in Focus.maybeOf
  File "focus_manager.dart", line 214, in FocusAttachment.reparent
  File "focus_scope.dart", line 550, in _FocusState.deactivate
  File "framework.dart", line 4811, in StatefulElement.deactivate
  File "framework.dart", line 1901, in _InactiveElements._deactivateRecursively
  File "framework.dart", line 4642, in ComponentElement.visitChildren
  File "framework.dart", line 1903, in _InactiveElements._deactivateRecursively
  File "framework.dart", line 4642, in ComponentElement.visitChildren
  File "framework.dart", line 1903, in _InactiveElements._deactivateRecursively
  File "framework.dart", line 4642, in ComponentElement.visitChildren
  File "framework.dart", line 1903, in _InactiveElements._deactivateRecursively
  File "framework.dart", line 1915, in _InactiveElements.add
  File "framework.dart", line 3667, in Element.deactivateChild
  File "framework.dart", line 3378, in Element.updateChild
  File "framework.dart", line 4613, in ComponentElement.performRebuild
  File "framework.dart", line 4763, in StatefulElement.performRebuild
  File "framework.dart", line 4311, in Element.rebuild
  File "framework.dart", line 2578, in BuildOwner.buildScope
  File "binding.dart", line 882, in WidgetsBinding.drawFrame
  File "binding.dart", line 363, in RendererBinding._handlePersistentFrameCallback
  File "binding.dart", line 1145, in SchedulerBinding._invokeFrameCallback
  File "binding.dart", line 1082, in SchedulerBinding.handleDrawFrame
  File "binding.dart", line 996, in SchedulerBinding._handleDrawFrame
  File "zone.dart", line 1428, in _rootRun
  File "zone.dart", line 1328, in _CustomZone.run
  File "zone.dart", line 1236, in _CustomZone.runGuarded
  File "hooks.dart", line 150, in _invoke
  File "platform_dispatcher.dart", line 270, in PlatformDispatcher._drawFrame
  File "hooks.dart", line 114, in _drawFrame
```

<details>
<summary>Code sample</summary>
No app code is involved.
Check `Element` in this repo.

</details>

<details>
  <summary>Logs</summary>

N/A
```
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
No issues found!
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->
App was built on CI, some time ago, so I could not execute shell commands. However, here is the relevant part of the log which is available:

```
Flutter 2.8.1 • channel unknown • unknown source
Framework • revision 77d935af4d (3 months ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
```

</details>

Device: Huawei VOG-L29
Android 10