You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
[webview_flutter] Add interface methods to load local files and HTML strings. (#4446)
* Add methods to load HTML and Flutter assets.
Adds methods to the webview_flutter_platform_interface to support
loading content from Flutter asset defined in the pubspec.yaml of
directly from HTML string.
* Renamed loadHtml to loadHtmlString
* Support loading arbitrary files instead of only Flutter assets
* Update changelog description
* Fix formatting
* Fix formatting
Copy file name to clipboardExpand all lines: packages/webview_flutter/webview_flutter_platform_interface/lib/src/method_channel/webview_method_channel.dart
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,24 @@ class MethodChannelWebViewPlatform implements WebViewPlatformController {
Copy file name to clipboardExpand all lines: packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_interface/webview_platform_controller.dart
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,32 @@ abstract class WebViewPlatformController {
Copy file name to clipboardExpand all lines: packages/webview_flutter/webview_flutter_platform_interface/test/src/method_channel/webview_method_channel_test.dart
+55Lines changed: 55 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,61 @@ void main() {
57
57
log.clear();
58
58
});
59
59
60
+
test('loadFile', () async {
61
+
await webViewPlatform.loadFile(
62
+
'/folder/asset.html',
63
+
);
64
+
65
+
expect(
66
+
log,
67
+
<Matcher>[
68
+
isMethodCall(
69
+
'loadFile',
70
+
arguments:'/folder/asset.html',
71
+
),
72
+
],
73
+
);
74
+
});
75
+
76
+
test('loadHtmlString without base URL', () async {
77
+
await webViewPlatform.loadHtmlString(
78
+
'Test HTML string',
79
+
);
80
+
81
+
expect(
82
+
log,
83
+
<Matcher>[
84
+
isMethodCall(
85
+
'loadHtmlString',
86
+
arguments:<String, String?>{
87
+
'html':'Test HTML string',
88
+
'baseUrl':null,
89
+
},
90
+
),
91
+
],
92
+
);
93
+
});
94
+
95
+
test('loadHtmlString without base URL', () async {
0 commit comments