flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

[desktop_webview_window] isWebviewAvailable

Open RizaldiWiratama opened this issue 3 years ago • 2 comments

WebviewWindow.isWebviewAvailable() return true when the user not installed WebView2 Runtime yet

and when i run

final webView = await WebviewWindow.create();
webView.launch(url);

it will just show new window with white screen and then not responding

flutter doctor -v [√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1466], locale en-ID) • Flutter version 2.8.1 at C:\sdk\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800 • Engine revision 890a5fca2e • Dart version 2.15.1

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at C:\Users\rizal\AppData\Local\Android\sdk • Platform android-32, build-tools 32.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

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

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.9) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.32106.194 • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3) • 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 11.0.10+0-b96-7249189)

[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.1466] • Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.99 • Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.55

• No issues found!

RizaldiWiratama avatar Jan 26 '22 04:01 RizaldiWiratama

According the document https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment :

Alternatively, call GetAvailableCoreWebView2BrowserVersionString and check whether the versionInfo is nullptr. If versionInfo is nullptr, that means that the WebView2 Runtime isn't installed on the client. If a preview channel of Microsoft Edge is installed (such as Beta, Dev, or Canary), the API returns version info for that preview channel.

The IsWebViewRuntimeAvailable should be work. (I tested on my Windows 11 PC, it seems works fine.)

https://github.com/MixinNetwork/flutter-plugins/blob/f591f7bd59a4dd9a28852e21b8df072bdab03d55/packages/desktop_webview_window/windows/web_view_window_plugin.cc#L14-L18

So if version_info is not null on your machine, can you help me print it out to see what its value is?

boyan01 avatar Jan 26 '22 04:01 boyan01

i only know about function WebviewWindow.isWebviewAvailable() & i don't know how to print that version_info can you elaborate more about that?

RizaldiWiratama avatar Jan 26 '22 06:01 RizaldiWiratama