Repository: flutter
Issue: [ios] Either AppLifecycleState or url_launcher fails to show correct screen after app is updated from Appstore
Labels: platform-ios,engine,P2,team-ios,triaged-ios

### Steps to reproduce

1) Install app on physical device, using a `version` which is older than the one deployed on AppStore
2) Show to user a `UpdateScreen` with an `updateButton` to update app (see pic attached below).
```
    // Open app on AppStore / GooglePlay
    final url = Platform.isIOS
              ? AppConfig.appStoreLink
              : AppConfig.googlePlayLink;
    await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
```
3) User is navigated to AppStore page and taps the `updateButton`.
4) App is updated and user taps "Open" button on Appstore page.
5) App is opened showing a strange "cached" version of `UpdateScreen`.
More info inside Code section.

We think this is a regression because we didn't have this issue long time ago.


### Expected results

If user taps "Open" button on AppStore page (after updating app), app should be opened as a fresh launch and display the initial Home screen, not showing any cached screen.

### Actual results

If user taps "Open" button on AppStore page (after updating app), app is opened back showing a sort of cached screen. Developer can do nothing with it. We tried to force navigating user to a different screen from `didChangeAppLifecycleState` state `resumed` but flutter won't show this different screen. It is like app is stuck in the screen showed to user before user tapped the `updateButton`.

### Code sample

<details open><summary>Code sample</summary>

Given the peculiarity of the issue, we can share only a snippet of our code (a sample would require a sample app deployed on AppStore). But we tried to provide more details here and inside the Screenshots section.

1) Install app on physical device, using a `version` which is older than the one deployed on AppStore
2) Show to user a `UpdateScreen` with an `updateButton` to update app (see pic attached below).
```
    // Open app on AppStore / GooglePlay
    final url = Platform.isIOS
              ? AppConfig.appStoreLink
              : AppConfig.googlePlayLink;
    await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
```
3) User is navigated to AppStore page and taps the `updateButton`.
4) App is updated and user taps "Open" button on Appstore page.
5) App is opened showing a strange "cached" version of `UpdateScreen`.
We say "cached" version because:
- if we navigate users to `HomeScreen` before they tapped the Update button, the `UpdateScreen` is still the one displayed to users when app is opened back from AppStore 
- if we remove the `UpdateScreen` and put the `updateButton` inside a Dialog Panel, the old no-more-used `UpdateScreen` is still the one displayed to users when app is opened back from AppStore (as it were cached by flutter engine or the system and displayed anyway even if it is no longer used at all).


</details>


### Screenshots or Video

This is the screen with the `updateButton`. As mentioned, if user taps "Open" button on AppStore page, the app is opened back and will always show IMG1 screen even if:
- we navigate user from `UpdateScreen` to `HomeScreen` "before" navigating user to AppStore
- we change the state of this screen (ie. changed the texts), the screen with old texts will be displayed to user when app is opened back from AppStore (as if screen were cached by either flutter or the system)
- we remove this screen, clean the build, install app from scratch and put the `updateButton` inside a dialog panel (see IMG2), IMG1 is the screen that is still displayed when app is opened back from AppStore. This makes us think that there should occur something at iOS level which flutter should try to workaround somehow to avoid this issue (?).
- we navigate user to a different screen from `didChangeAppLifecycleState` state `resumed` but IMG1 is the screen that is still be displayed to user.

### IMG1:
![IMG_9787](https://github.com/user-attachments/assets/9ce964f5-25d6-4309-bfbb-a1d06284594e)


### IMG2:
![IMG_9821](https://github.com/user-attachments/assets/dbb4f248-8a8b-4917-b7d3-479024ded9e6)


</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.27.0-1.0.pre.31, on macOS 14.2.1 23C71 darwin-arm64, locale en-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)
[✓] Network resources

```

</details>