Flutter Desktop WebView backed by CEF (Chromium Embedded Framework). This project is under heavy development, and the APIs are not stable yet.
Inside your application folder, you need to add two lines in your windows\runner\main.cpp
.(Because of Chromium multi process architecture.)
#include "webview_cef/webview_cef_plugin_c_api.h"
#include "webview_cef/webview_cef_plugin_c_api.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
//start cef deamon processes. MUST CALL FIRST
initCEFProcesses();
When building the project for the first time, a prebuilt cef bin package (200MB, link in release) will be downloaded automatically, so you may wait for a longer time if you are building the project for the first time.
To use the plugin in macOS, you'll need to clone the repository onto your project location, prefereably inside a packages/
folder on the root of your project.
Update your pubspec.yaml
file to accomodate the change.
...
dependencies:
# Webview
webview_cef:
path: ./packages/webview_cef # Or wherever you cloned the repo
...
Then follow the below steps inside the macos/
folder of the cloned repository.
Note: You can also download universal binary for build an mac-universal app if you want to build an mac universal app. See #30. Thanks to @okiabrian123.
-
Unzip the archive and put all files into
macos/third/cef
. (Inside the cloned repository, not your project) -
Run the example app.
**[HELP WANTED!]**
Finding a more elegant way to distribute the prebuilt package.
Note: Currently the project has not been enabled with multi process support due to debug convenience. If you want to enable multi process support, you may want to enable multi process mode by changing the implementation and build your own helper bundle. (Finding a more elegant way in the future.)
This part of the content needs to be summarized. You can refer to the methods in the example first(Very similar to on the Windows). In addition, you need to modify the method of copying resources in the linux/CMakeLists.txt under your own project to be consistent with that in windows. Otherwise, the resource files cannot be copied properly under linux.
Pull requests are welcome.
- Windows support
- macOS support
- Linux support
- Multi instance support
- IME support
- Mouse events support
- JS bridge support
- Cookie manipulation support
- Release to pub
- Trackpad support
- Better macOS binary distribution
- Easier way to integrate macOS helper bundles(multi process)
- devTools support
This demo is a simple webview app that can be used to test the webview_cef
plugin.
Windows | macOS | Linux |
---|---|---|
This project is inspired from flutter_webview_windows
.