How to check if Flutter app in running in webview

Issue

I have built a web app in Flutter and I want to check where the app is running.
My app runs in the normal browser, in Microsoft Teams and in a WebView within another Flutter app.

In all cases the kIsWeb bool is true.

With the device_info_plus package I only get errors…

And with the web_browser_detect (on iOS) only safari back as the browser (even if it is in the webview)

Does anyone know a solution?

Solution

I think you are needing to look at userAgent. See this answer:
https://stackoverflow.com/a/67644049/233382
or this answer
How to get device user agent information in Flutter

Answered By – chongman

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *