papyrus_windows 0.1.1
papyrus_windows: ^0.1.1 copied to clipboard
Windows WebView2 backend for Papyrus, a secure policy-driven federated WebView plugin for Flutter apps.
papyrus_windows #
Windows WebView2 implementation package for Papyrus.
The native implementation detects missing WebView2 Runtime, maps policy to CoreWebView2 settings, intercepts navigation/resources, handles process failure events, and reports capability differences.
If WebView2 runtime creation fails, Papyrus reports
webViewUnavailable with actionable diagnostics.
Windows uses the shared desktop overlay model rather than a Flutter platform
view. PapyrusView lays out a Flutter placeholder and the plugin positions the
native WebView2 surface over that rectangle via setViewport.
Initial loads are scheduled after viewport synchronization so first paint does
not race zero-sized bounds during startup.
Native Windows tests #
From examples/papyrus_example:
flutter pub get
flutter build windows --debug
cmake -S windows -B build/windows/x64 "-Dinclude_papyrus_windows_tests=ON" "-DCMAKE_POLICY_VERSION_MINIMUM=3.10"
cmake --build build/windows/x64 --config Debug --target papyrus_windows_test
ctest --test-dir build/windows/x64/plugins/papyrus_windows -C Debug --output-on-failure
Packaging Windows installers (WebView2 dependencies) #
Papyrus links the WebView2 loader statically, so apps do not need to ship
WebView2Loader.dll. The required runtime dependency is Microsoft Edge
WebView2 Runtime.
Recommended installer strategies:
-
Evergreen Bootstrapper (small online installer)
- Bundle or download
MicrosoftEdgeWebView2Setup.exe. - Run silently during install:
/silent /install. - Best when internet access is available.
- Bundle or download
-
Evergreen Standalone Installer (offline)
- Bundle architecture-specific runtime installers (x64/x86/arm64).
- Run silently during install:
/silent /install. - Best for offline or controlled enterprise environments.
Current Papyrus behavior:
- The Windows plugin creates WebView2 with
CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, ...). - This targets installed runtime discovery (Evergreen runtime model).
- Fixed Version runtime folders are not wired through plugin configuration.
Practical packaging checklist:
- Match runtime installer architecture to your app build architecture.
- Install WebView2 Runtime before first launch of the app.
- Keep the app-side error handling for
webViewUnavailableas a fallback for machines where runtime installation fails or is blocked.