0

I'm using the webview_flutter package in my Flutter app to display a webpage when a button is pressed. Everything works as expected in the Xcode iOS simulator and when I run the app on a physical device through Xcode (with debug mode), but when I use flutter run --release to release the app onto the device, the WebView shows only a gray screen and nothing loads. In other words:

1): The WebView loads fine in both the simulator and the physical device in debug mode.

2): The issue (grey screen; not loading) only occurs when running the app in release mode (flutter run --release).

I've tried troubleshooting the following:

1): Rebuilding the app (flutter clean, then flutter run --release).

2): Checking for any errors or logs, but none seem to show up related to the WebView issue in the release build.

Why does the WebView fail to load in release mode on the iOS device, and how can I fix it? Any help is greatly appreciated!

iOS version: 18.0.1

Flutter version: 3.22.2

Xcode version: 16.0

macOS version: 15.0

1

1 Answer 1

1

I know this is old, but it happened to me today, and here is my solution.

What caused it was I had a webview in an expanded widget and the expanded widget in a column.
So: Column(Expanded(Webview))

Replacing the expanded widget with a sizedbox with a specified height solved the problem.

reference this issue on Github for clarity: https://github.com/flutter/flutter/issues/108186

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I forgot to answer my own question, but that is indeed what fixed my issue; the extra Expanded() widget.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.