Skip to content

webview_flutter 4.10.0 lags whole app on S9+ #164968

@aMuTeX

Description

@aMuTeX

What package does this bug report belong to?

webview_flutter

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
name: s9p_test
description: "A new Flutter project."

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: ^3.7.0

dependencies:
  flutter:
    sdk: flutter
  webview_flutter: ^4.10.0

  cupertino_icons: ^1.0.8

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^5.0.0

flutter:

  uses-material-design: true

Steps to reproduce

  1. Run a Flutter app with webview_flutter and Impeller enabled on Samsung Galaxy S9+ (star2lte) with Android 10.0
  2. App is not usable as it lags extremely

Expected results

The Flutter app should run performant, as it does on other Android devices.

Actual results

App is very laggy on Samsung Galaxy S9+ but not on other devices. As soon as the WebViewWidget is included (probably its controller needs to be initialized) the whole app is laggy, even if the Webview is not visible.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late WebViewController _controller;

  @override
  void initState() {
    _controller =
        WebViewController()
          ..setJavaScriptMode(JavaScriptMode.unrestricted)
          ..setNavigationDelegate(
            NavigationDelegate(
              onPageStarted: (String url) {},
              onPageFinished: (String url) {},
              onHttpError: (HttpResponseError error) {},
              onWebResourceError: (WebResourceError error) {},
              onNavigationRequest: (NavigationRequest request) {
                return NavigationDecision.navigate;
              },
            ),
          )
          ..loadRequest(Uri.parse("https://www.google.com"));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
        actions: [IconButton(onPressed: () {}, icon: Icon(Icons.help))],
      ),
      body: WebViewWidget(
        controller: _controller,
      ),
    );
  }
}

Screenshots or Videos

https://streamable.com/zf88cn

Logs

https://pastebin.com/F3AdWTFu

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.29.1, on Microsoft Windows [Version 10.0.26100.3323], locale de-CH) [498ms]
    • Flutter version 3.29.1 on channel stable at C:\Tools\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 09de023485 (11 days ago), 2025-02-28 13:44:05 -0800
    • Engine revision 871f65ac1b
    • Dart version 3.7.0
    • DevTools version 2.42.2

[√] Windows Version (11 Pro 64-bit, 24H2, 2009) [7.7s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.0s]
    • Android SDK at C:\Users\xx\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[√] Chrome - develop for the web [230ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.13.2) [229ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.13.35825.156
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.3) [11ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[√] VS Code (version 1.97.2) [10ms]
    • VS Code at C:\Users\xx\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (4 available) [232ms]
    • SM S911B (mobile) • RFCTC0GDWHT • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.26100.3323]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 134.0.6998.36
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 133.0.3065.82

[√] Network resources [763ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy