Capturing Web Views

If your Flutter app uses webview_flutter to render content from a URL, you can record the widget's contents in mobile session playback by confirming the following:

  • The app is on version 2.2.0 or higher of the mobile SDK
  • The Flutter SDK has been initialized in the mobile app (see docs)
  • The web SDK is initialized in the rendered web page, using the same app ID as the surrounding mobile session (see docs)
  • In order to record view content within mobile sessions on Android devices, the widget must have a GlobalKey assigned to it's key attribute and be registered with the LogRocket SDK. See an example of this below:
class WebViewPage extends StatefulWidget {
  const WebViewPage({super.key});

	@override
  State<WebViewPage> createState() => _WebViewPageState();
}

class _WebViewPageState extends State<WebViewPage> {
  final _webViewKey = GlobalKey();
	final controller = WebViewController()

	@override
	void initState() {
    super.initState();

    LogRocket.registerWebView(_webViewKey).then((_) {
      controller.loadRequest(Uri.parse('https://www.myapp.com'));
    });
	}

	@override
  Widget build(BuildContext context) {
    return WebViewWidget(key: _webViewKey, controller: controller);
  }
}

The events we record for web sessions (clicks, site navigation, etc.) will appear alongside mobile events in session playback. The linked recordings will only count as a single session against your quota.