Repository: flutter
Issue: build is called on IOS when app goes to background
Labels: platform-ios,engine,has reproducible steps,P2,team-ios,triaged-ios,found in release: 3.22,found in release: 3.23

### Steps to reproduce

In the example code below, I have added a call to MediaQuery.of(context) to simulate the behavior Im observing in more complex apps.

Why is build called when the app goes to background?
This happens in IOS but not in Android. 

In my app this is making components down the tree throw errors. Before checking component by component, I would like to know if this is expected behavior, and if it can be avoided.

Regards


### Expected results

Not to build when app goes to background in IOS

### Actual results

rebuild called

### Code sample

```dart

import 'package:flutter/material.dart';


void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    MediaQueryData mdq = MediaQuery.of(context);
    print('MediaQueryData: $mdq');
    return const Scaffold(
      body: Center(
        child: Column(),
      ),
    );
  }
}

```


### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale es-AR)
    • Flutter version 3.22.1 on channel stable at /Users/pablo/Proyectos/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (11 days ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/pablo/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/pablo/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/pablo/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • 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.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.91.20240529

[✓] Connected device (7 available)
    • moto g 8 plus (mobile)              • ZY22764PJC                           • android-arm64  • Android 10 (API 29)
    • sdk gphone64 arm64 (mobile)         • emulator-5554                        • android-arm64  • Android 14 (API 34) (emulator)
    • iPhone de Pablo (mobile)            • 00008110-001E38D03651801E            • ios            • iOS 17.4.1 21E236
    • iPhone SE (3rd generation) (mobile) • 014EA9C8-3E33-4C5E-AEAD-E37A20067FF8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop)     • mac-designed-for-ipad                • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 125.0.6422.114

[✓] Network resources
    • All expected network resources are available.

• No issues found!