Skip to content

[PlatformView] WebView renders incorrectly or overlaps Flutter content after resuming from background via deeplink or notification (Flutter 3.27.4) #169873

Open
@gj-thaoht

Description

@gj-thaoht

On Flutter apps using WebView (via flutter_inappwebview, webview_flutter, or any PlatformView-based plugin), when the app is resumed from the background via a deeplink or notification, the WebView sometimes:

  • Appears above the expected screen (overlapping Flutter content).

  • Shows a blank/white screen.

  • Fails to update or disappear even after navigation changes.

  • Visually "freezes" at the previous frame while the Flutter screen has changed underneath.

These bugs occur even though the Flutter route has changed correctly and widgets are being rebuilt.

Steps to reproduce

Reproduction Steps

  1. Open a Flutter screen that displays a WebView (using any package that uses PlatformView).
  2. Press home or background the app.
  3. Tap on a push notification or a deeplink to bring the app back into a new route (e.g. using Navigator.pushNamed(...)).
  4. Observe the screen.

Expected results

  • The app navigates to the correct Flutter route.
  • The previous WebView is fully removed or invisible.
  • There is no residual content or overlay from the previous PlatformView.

Actual results

  • WebView content from the previous screen remains visible on top of the current route.
  • In some cases, it shows a white screen or flickers.
  • The rendering stack between Flutter UI and PlatformView becomes inconsistent.

Test on:

  • Flutter 3.27.4
  • iOS 18.1.1 (real device)

Package use:

  • flutter_inappwebview: 6.1.5
  • webview_flutter: 4.13.0

Current Workarounds:

Developers (including myself) have attempted to mitigate this using:

  • Using WidgetsBindingObserver to detect AppLifecycleState.resumed, and manually triggering recovery logic, such as re-initializing or reloading WebView content, or pushing back navigation.
  • ...

These solutions are fragile and non-scalable, especially in apps with dynamic routing and multiple WebViews.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions