-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content #8787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
5e0c659 to
3417b52
Compare
3417b52 to
bc4128f
Compare
bparrishMines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agavrilko To follow the pattern of other methods, we should introduce a new platform interface method to webview_flutter_platform_interface. Something like PlatformWebViewController.loadFileWithParams(LoadFileParams). LoadFileParams would contain a url parameter. Then the webview_flutter_wkwebview package can create its own implementation of LoadFileParams with the readAccessUrl parameter because it is unique to iOS/macOS.
|
Hello @bparrishMines, I initially aimed to introduce this minor update without making any API changes, focusing solely on exposing the functionality that was already present but not accessible to users. Based on my understanding, your suggestion would require:
While this design would make the API more consistent and extensible, it would also introduce a breaking change for current users, requiring them to update their code. And if my understanding is correct, should I just update an existing |
|
@agavrilko I think you should create a new platform interface method named something like: Everything else you stated seems correct. Additionally, after this feature lands, |
bc4128f to
afad597
Compare
afad597 to
e3639a2
Compare
|
Hello @bparrishMines I'm seeing that the pipeline fails due to a version resolution issue:
Could you please advise on the proper workflow for updating versions across the packages? Thank you! |
|
@agavrilko Yes, you can follow https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins for the process. |
d08642a to
bffcb4e
Compare
bffcb4e to
f3090f0
Compare
|
Hello @bparrishMines, I need further assistance with this PR. But it looks like changing
Should this change be split into 2 different PRs? |
bparrishMines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agavrilko Yes, this PR won't be published as is. The first step is to get this PR approved first, then individual PRs for each package will be created. This allows us to review all the changes together before we start landing seaprate PRs.
| /// such as headers (on Android) or resource paths (on iOS/macOS). | ||
| /// | ||
| /// Throws a `PlatformException` if the [absoluteFilePath] does not exist. | ||
| Future<void> loadFileWithParams(LoadFileParams params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method shouldn't be necessary. A user can now use the platform specific loadFileWithParams to add platform specific parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I am property understand this comment.
Do you suggest to remove this method from the WebViewController class?
The loading of the file with custom parameters would look like the following:
switch (controller.platform) {
case final WebKitWebViewController platform:
platform.loadFileWithParams(...)default:
...
}
Just want to ensure I understand it right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. WebViewController.loadFileWithParams should be removed and users could use the code snippet you provided to access the platform-specific params. The goal of the app-facing package is to provide a simple and clean API while the platform interface provides a more robust and extendable API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method was removed.
All changes to the WebViewController were reverted.
| /// `/Users/username/Documents/www/index.html`. | ||
| /// | ||
| /// Throws a `PlatformException` if the [absoluteFilePath] does not exist. | ||
| @Deprecated('Use loadFileWithParams(LocalFileParams params) instead. ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't need deprecation. This can just change the platform call from platform.loadFile to platform.loadFileWithParams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| /// Platform-specific implementations can add additional fields by extending | ||
| /// this class. | ||
| /// | ||
| /// {@tool sample} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// {@tool sample} |
This doesn't actually do anything right now. We just haven't removed them from other classes yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| /// final String readAccessPath; | ||
| /// } | ||
| /// ``` | ||
| /// {@end-tool} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// {@end-tool} |
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| /// this class. | ||
| /// | ||
| /// {@tool sample} | ||
| /// This example demonstrates how to extend [LocalFileParams] to provide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// This example demonstrates how to extend [LocalFileParams] to provide | |
| /// This example demonstrates how to extend [LoadFileParams] to provide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
| class WebKitLoadFileParams extends LoadFileParams { | ||
| /// Constructs a [WebKitLoadFileParams], the subclass of a [LoadFileParams]. | ||
| /// | ||
| /// The optional [readAccessPath] defines the directory that the WebView is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this information should be moved to the documentation for the field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
| class AndroidLoadFileParams extends LoadFileParams { | ||
| /// Constructs a [AndroidLoadFileParams], the subclass of a [LoadFileParams]. | ||
| /// | ||
| /// Optionally, [headers] map may be included, which contains key-value pairs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this information should be moved to the field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
| /// that will be passed as additional HTTP headers when loading the file. | ||
| AndroidLoadFileParams({ | ||
| required String absoluteFilePath, | ||
| this.headers = _defaultHeaders, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work right?
| this.headers = _defaultHeaders, | |
| this.headers = const <String, String>{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| _webView.pigeon_instanceManager.getIdentifier(_webView)!; | ||
|
|
||
| @override | ||
| Future<void> loadFile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated in the iOS implementation as well, we keep loadFile and it should just call loadFileWithParams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| } | ||
|
|
||
| test('loadFile without file prefix', () async { | ||
| test('Initializing WebView settings on controller creation', () async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the loadFile method will be kept in AndroidWebViewController, one of the tests for loadFile should be kept.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'loadFile' tests restored under 'loadFile' group.
NOTE: the test on 277 line was not related to the 'loadFile' method, this change just fixes the label.
f3090f0 to
9531f5c
Compare
|
@agavrilko Is this waiting for another review? |
29db233 to
aa37e8d
Compare
Hello @bparrishMines, my apologies, I did not see the notification about your reply. I have rebased the branch onto the latest |
bparrishMines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a handful of nits. Thanks for working on this!
@stuartmorgan-g / @tarrinneal This is ready for a secondary review.
| /// Platform-specific implementations may extend [LocalFileParams] to support | ||
| /// additional parameters, such as iOS/macOS-specific read access options. | ||
| /// | ||
| /// Throws an [ArgumentError] if the file specified in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't think this is true anymore for this method. I see that this was copied from loadFile, but this sentence can be removed for this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from loadFileWithParams only.
| ); | ||
| } | ||
|
|
||
| /// Additional HTTP headers to be included when loading the local file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Separate first sentence.
| /// Additional HTTP headers to be included when loading the local file. | |
| /// Additional HTTP headers to be included when loading the local file. | |
| /// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| ) async { | ||
| switch (params) { | ||
| case final AndroidLoadFileParams params: | ||
| await _webView.settings.setAllowFileAccess(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Using Future.wait here is a little faster. Method calls are called sequentially and are handled synchronously.
| await _webView.settings.setAllowFileAccess(true); | |
| await Future.wait(<Future<void>>[ | |
| _webView.settings.setAllowFileAccess(true), | |
| _webView.loadUrl(params.absoluteFilePath, params.headers), | |
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
I'm not familiar with the internal implementation, but these operations seem closely related. Could this introduce any potential race conditions? Setting the access flag after the page starts loading doesn't seem reliable to me.
| ); | ||
| } | ||
|
|
||
| /// The directory to which the WebView is granted read access. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Separate first sentence.
| /// The directory to which the WebView is granted read access. | |
| /// The directory to which the WebView is granted read access. | |
| /// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| @@ -1,3 +1,7 @@ | |||
| ## 4.8.0 | |||
|
|
|||
| * Introduces `AndroidLoadFileParams`, a platform-specific extension of `LoadFileParams` for Android that adds support for `headers`. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add something like this
| * Introduces `AndroidLoadFileParams`, a platform-specific extension of `LoadFileParams` for Android that adds support for `headers`. | |
| * Adds support for `PlatformWebViewController.loadFileWithParams`. | |
| * Introduces `AndroidLoadFileParams`, a platform-specific extension of `LoadFileParams` for Android that adds support for `headers`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
| ## 3.23.0 | ||
|
|
||
| * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. | ||
| * Introduces `WebKitLoadFileParams`, a platform-specific extension of `LoadFileParams` for iOS and macOS that adds support for `readAccessPath`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment from Android.
| * Introduces `WebKitLoadFileParams`, a platform-specific extension of `LoadFileParams` for iOS and macOS that adds support for `readAccessPath`. | |
| * Adds support for `PlatformWebViewController.loadFileWithParams`. | |
| * Introduces `WebKitLoadFileParams`, a platform-specific extension of `LoadFileParams` for iOS and macOS that adds support for `readAccessPath`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
| ## 2.14.0 | ||
|
|
||
| * Adds `PlatformWebViewController.loadFileWithParams(LoadFileParams)` to support loading local HTML files with platform-specific parameters. | ||
| * Deprecates `PlatformWebViewController.loadFile(String)` in favour of `PlatformWebViewController.loadFileWithParams(LoadFileParams)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed for now since we won't deprecate it until after the platform implementations have landed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do deprecations in the initial pass now. That used to be impossible due to linting, but we no longer have deprecation lints enabled in the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from the change log, since we removed it from the code.
aa37e8d to
1650c9b
Compare
| Future<void> loadFileWithParams( | ||
| LoadFileParams params, | ||
| ) { | ||
| throw UnimplementedError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should call the old method, not throw. See step 1 of https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-platform-interface-method-parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that pass-through should be unit-tested in this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadFileWithParams implementation was updated. Unit test added.
1650c9b to
095941d
Compare
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go forward with splitting out the platform interface PR.
|
Hello @bparrishMines, @stuartmorgan-g Here is the PR with only platform interface changes. Let me know if I applied the version bump correctly. |
5365594 to
a28b4cc
Compare
|
Hello @bparrishMines, @stuartmorgan-g All tests and formatting passes just fine locally,
Looks like the latest version is not being pulled:
But why this happens I can't tell. |
Because you have code that requires 2.14.0, but (incorrectly) haven't indicated in pubspec.yaml that the package requires 2.14.0, so the |
|
Thank you @stuartmorgan-g for explaining what In this case, since main webview_backage depends on platform interface and depends on wkwebview & andorid, that depend on platform interface as well: I believe it will be right to create another PR to update Is my understanding correct? |
I don't understand what you are proposing here, since there are no The solution to the CI failures is to update the packages in this PR to properly express the minimum versions of the dependencies they require. |
ec15515 to
5d33e50
Compare
|
I have update the references in android and wkwebview packages. |
bparrishMines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
||
| /// Additional HTTP headers to be included when loading the local file. | ||
| /// | ||
| /// If not provided at initialization time, doesn't add any addition headers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| /// If not provided at initialization time, doesn't add any addition headers. | |
| /// If not provided at initialization time, doesn't add any additional headers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
…L pages on iOS and Android flutter/flutter#136479 • Introduces `AndroidLoadFileParams` to specify additional header flags while loading local HTML pages on Android • Introduces `WebKitLoadFileParams` to customize path to the additional resources (css, js) while loading local HTML pages on iOS/macOS
5d33e50 to
0226974
Compare
…dd flexibility when working with local HTML content (flutter/packages#8787)
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
* main: (56 commits) [go_router_builder] Support extension types (flutter#9458) Roll Flutter from e2a347b14a18 to 34c2a3b158b2 (41 revisions) (flutter#9803) [go_router_builder] Migrate to Element2 API and update dependencies (flutter#9649) [in_app_purchase_storekit] Add support for quantity in consumable product purchases (#171570) (flutter#9698) [pigeon] Improves documentation of `ProxyApi` and moves helper functions to a separate file (flutter#9756) Roll Flutter from 1590543f6794 to e2a347b14a18 (1 revision) (flutter#9784) [camera_avfoundation] Implementation swift migration - part 11 (flutter#9690) [camera_avfoundation] Fix crash when streaming while recording (flutter#9691) Roll Flutter from 38217906e95c to 1590543f6794 (14 revisions) (flutter#9780) Roll Flutter from 92a6bfbfd6ef to 38217906e95c (17 revisions) (flutter#9778) [video_player] Improve KVO handling on iOS (flutter#9718) [dependabot]: Bump the test-dependencies group across 15 directories with 7 updates (flutter#9736) Roll Flutter from 9de63a03428f to 92a6bfbfd6ef (11 revisions) (flutter#9769) [google_maps_flutter_platform_interface] Add Advanced markers support (flutter#9737) [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter#9760) [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter#9674) Roll Flutter from 59fc766c6fdf to 9de63a03428f (6 revisions) (flutter#9764) [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter#8787) [local_auth] Differentiate iOS authentication errors (flutter#9705) manual roll to 59fc766c6fdfd03d0983fc95ce8b76793a300dd5 (flutter#9758) ... # Conflicts: # packages/go_router_builder/lib/src/type_helpers.dart # packages/go_router_builder/pubspec.yaml
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@f0b2726...6efb759 2025-08-06 [email protected] [camera_android_camerax] Re-land "Force new Surface for each SurfaceRequest" (flutter/packages#9760) 2025-08-06 [email protected] [google_maps_flutter] Add ability to perform Google Maps SDK warmup (flutter/packages#9674) 2025-08-06 [email protected] Roll Flutter from 59fc766 to 9de63a0 (6 revisions) (flutter/packages#9764) 2025-08-06 [email protected] [webview_flutter_wkwebview] Extended Web View API on iOS to add flexibility when working with local HTML content (flutter/packages#8787) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md



Overview
The
readAccessURLProviderproperty has been added to theWebKitWebViewControllerCreationParamsclass. This function allows customization of the path to associated resources when loading a local HTML page usingloadFileon iOS.What Is the Issue
Fixes flutter/flutter#136479
The native
WKWebViewtakes two arguments when loading local HTML pages:WKWebViewcan access (e.g., .css, .js files).Currently, the Flutter implementation always sets the parent folder of the specified HTML file as the read access directory. This behavior is not configurable, which limits how local web content can be structured.
For example, the following structure does not work because the .css and .js files are not in the parent directory of the HTML file:
With the existing behavior,
WKWebViewcannotaccess styles/main.cssandscripts/app.jsbecause the parent folder ofindex.html(/pages/) does not contain them.How This Resolves the Issue
The
readAccessURLProviderproperty has been added to theWebKitWebViewControllerCreationParamsclass. This property accepts a function that takes the path of the HTML file being loaded and returns the path to the associated resources.Each time
loadFileis called, the controller invokes this function and passes its result as the second argument to the underlyingWKWebViewimplementation.By default, the function returns the parent directory of the specified HTML file, preserving the existing behavior when no custom provider is set.
Impact on End Users
WKWebViewshould allow access to when loading a local HTML page, providing greater flexibility in organizing assets.Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.